Serhiy Storchaka <storchaka+cpyt...@gmail.com> added the comment:

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?

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33346>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to