Author serhiy.storchaka
Recipients asvetlov, ericvw, gvanrossum, levkivskyi, pablogsal, serhiy.storchaka, yselivanov
Date 2018-05-11.16:31:09
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1526056269.22.0.682650639539.issue33346@psf.upfronthosting.co.za>
In-reply-to
Content
There are several related PEPs:

PEP 492 -- Coroutines with async and await syntax
PEP 525 -- Asynchronous Generators
PEP 530 -- Asynchronous Comprehensions

I haven't found anything explicit about this case. PEP 492 says that just "await" is not enough for converting a function into a coroutine. Explicit "async def" is required. PEP 530 says nothing about implementation details, it omits the fact that comprehensions are implemented by creating and calling an implicit function. From the implementation's point of view PEP 530 means that "async for" and "await" inside an implicit function make it an asynchronous function, and implicit "await" is added in the place of it's call. The natural extension of this is than an implicit "await" should have the same effect as explicit "await", in particular it should make an outer implicit function an asynchronous function and add other implicit "await" in the place of it's call, and so forth. But all this is implied, and is not said explicitly.

I don't understand one paragraph in PEP 530:

"""
In principle, asynchronous generator expressions are allowed in
any context.  However, in Python 3.6, due to ``async`` and ``await``
soft-keyword status, asynchronous generator expressions are only
allowed in an ``async def`` function.  Once ``async`` and ``await``
become reserved keywords in Python 3.7, this restriction will be
removed.
"""

Does it mean that even more restrictions should be removed than PR 6766 does? And what is the relation between this restriction and making "async" and "await" reserved keywords?
History
Date User Action Args
2018-05-11 16:31:09serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, ericvw, asvetlov, yselivanov, levkivskyi, pablogsal
2018-05-11 16:31:09serhiy.storchakasetmessageid: <1526056269.22.0.682650639539.issue33346@psf.upfronthosting.co.za>
2018-05-11 16:31:09serhiy.storchakalinkissue33346 messages
2018-05-11 16:31:09serhiy.storchakacreate