Learn Before
Concept icon
Concept

Asyncio Syntax

The asyncio module makes use of the keywords

async

and

await

async is placed before the function declaration def and turns the function into a native coroutine or an asynchronous generator. Placing await inside an async function creates a coroutine while placing the yield keyword creates an asynchronous generator.

await passes function control back to the event loop by suspending the coroutine. the await keyword in a function waits for a different function to execute and allows the main program to execute other code.

0

1

Concept icon
Updated 2021-04-30

Tags

Python Programming Language

Data Science

Related