Await expressions

Mild Shock janburse at fastmail.fm
Fri Jan 26 15:08:33 EST 2024


We say that an object is an awaitable object if it can be used in an 
await expression. Many asyncio APIs are designed to accept awaitables.

There are three main types of awaitable objects:
coroutines, Tasks, and Futures.

Stefan Ram schrieb:
>    In "The Python Language Reference, Release 3.13.0a0",
>    there is this section:
> 
> |6.4 Await expression
> |
> |Suspend the execution of coroutine on an awaitable object.
> |Can only be used inside a coroutine function.
> |
> |await_expr ::= "await" primary
> |
> |New in version 3.5.
> 
>    . And this is the whole section.
> 
>    What I do not understand:
> 
>    - Which coroutine is suspended?
>    - Which object is the object mentioned?
>    - For what purpose is the value of the primary expression used?
>    - What does it mean to "suspend something on something"?
> 



More information about the Python-list mailing list