[Python-Dev] Addendum to PEP 530
storchaka at gmail.com
Mon Mar 4 12:37:17 EST 2019
PEP 530 introduced support for asynchronous comprehensions.
Comprehensions are implemented as local functions. To make a function
asynchronous you should to add "async" before "def", and after that you
can use "async for", "async with" and "await" in a function. But you can
to do this with comprehensions, since these functions are implicit.
PEP 530 allows to make these function asynchronous by just using
asynchronous syntax inside. "async with" can not be used in
comprehensions, but using "async for" or "await" makes the comprehension
What PEP 530 missed is that asynchronous comprehensions itself are
asynchronous constructions which can be used only in asynchronous functions.
Issue33346  makes an asynchronous comprehension inside a
comprehension making the outer comprehension asynchronous as well as
using explicit "async for" or "await". See details on the issue.
Yury, the author of PEP 530, likes this idea, and there is a ready
implementation. But making the decision was deferred until a new
government be stated. Now, after the Steering Council has been elected,
can it make the decision?
More information about the Python-Dev