[Python-ideas] async/await in Python

Yury Selivanov yselivanov.ml at gmail.com
Sun Apr 19 17:30:23 CEST 2015


Steven,

On 2015-04-19 10:01 AM, Steven D'Aprano wrote:
> Let's see if I have them all...
>
> Generator-based:
> - must use `yield` as an expression;
> - cannot use `await`; (?)
> - must be declared with a plain `def`;
> - must be primed before use;
> - use the send() method;

Correct, generator-based cannot use 'await';
>
> Async-def:
> - must not use `yield` or `yield from`;
> - may use `await`; (?)
> - must be declared with `async def`;
> - don't need priming;
> - the send() method isn't used; (?)
And async-def can use await; and send()/throw() methods
are used by asyncio and libraries.

Yury


More information about the Python-ideas mailing list