Re: Await expressions (Posting On Python-List Prohibited)
>On 27/01/24 10:46 am, Stefan Ram wrote: >>But your explanation seems to have no mention of the "something" / >>"the awaitable object" part following the preposition "on". Shouldn't >>this awaitable object play a rôle in the explanation of what happens? You can explain a function call without saying much about the called function. Similarly, you can explain "await " without saying much about "". Important is only: "" evaluates to an "awaitable". An "awaitable" (usually an `asyncio.Future`, `asyncio.Task` or call of an `async` function) eventuelly produces a value and `await ` waits until this happens and then returns this value. Not everything which eventually returns a value is an "awaitable" -- e.g. a call of `time.sleep` is not an "awaitable". Special provisions are necessary to be able to wait for a value (and meanwhile do other things). `asyncio.sleep` has e.g. this provisions and a call of it is an "awaitable". -- https://mail.python.org/mailman/listinfo/python-list
Re: Await expressions
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"? -- https://mail.python.org/mailman/listinfo/python-list
Re: Await expressions
Maybe consult: PEP 492 – Coroutines with async and await syntax Created: 09-Apr-2015 Python-Version: 3.5 https://peps.python.org/pep-0492/ Mild Shock schrieb: 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"? -- https://mail.python.org/mailman/listinfo/python-list