diff options
author | Serhiy Storchaka <storchaka@gmail.com> | 2021-07-13 21:27:50 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-07-13 21:27:50 (GMT) |
commit | 054e9c84ac7c394941bba3ea1829d14dce1243fc (patch) | |
tree | edd3cbe6ed6083909280d8aaed50c8d2679b4fde /Doc/reference | |
parent | 0ee0a740e12ec8568aafa033aa6bb08b265afe26 (diff) | |
download | cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.zip cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.tar.gz cpython-054e9c84ac7c394941bba3ea1829d14dce1243fc.tar.bz2 |
bpo-33346: Allow async comprehensions inside implicit async comprehensions (GH-6766)
Co-authored-by: Pablo Galindo <pablogsal@gmail.com>
Diffstat (limited to 'Doc/reference')
-rw-r--r-- | Doc/reference/expressions.rst | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 5ad640a..aaa2134 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -218,9 +218,9 @@ A comprehension in an :keyword:`!async def` function may consist of either a :keyword:`!for` or :keyword:`!async for` clause following the leading expression, may contain additional :keyword:`!for` or :keyword:`!async for` clauses, and may also use :keyword:`await` expressions. -If a comprehension contains either :keyword:`!async for` clauses -or :keyword:`!await` expressions it is called an -:dfn:`asynchronous comprehension`. An asynchronous comprehension may +If a comprehension contains either :keyword:`!async for` clauses or +:keyword:`!await` expressions or other asynchronous comprehensions it is called +an :dfn:`asynchronous comprehension`. An asynchronous comprehension may suspend the execution of the coroutine function in which it appears. See also :pep:`530`. @@ -230,6 +230,11 @@ See also :pep:`530`. .. versionchanged:: 3.8 ``yield`` and ``yield from`` prohibited in the implicitly nested scope. +.. versionchanged:: 3.11 + Asynchronous comprehensions are now allowed inside comprehensions in + asynchronous functions. Outer comprehensions implicitly become + asynchronous. + .. _lists: |