diff options
author | Yury Selivanov <yury@magic.io> | 2017-10-06 06:58:28 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-06 06:58:28 (GMT) |
commit | b8ab9d3fc816f85f4d6dbef12b7414e6dc10e4dd (patch) | |
tree | 0baec2d80c9dc9f81b215fafd0074edec43730cb /Doc | |
parent | faa135acbfcd55f79fb97f7525c8aa6f5a5b6a22 (diff) | |
download | cpython-b8ab9d3fc816f85f4d6dbef12b7414e6dc10e4dd.zip cpython-b8ab9d3fc816f85f4d6dbef12b7414e6dc10e4dd.tar.gz cpython-b8ab9d3fc816f85f4d6dbef12b7414e6dc10e4dd.tar.bz2 |
bpo-31708: Allow async generator expressions in synchronous functions (#3905)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/expressions.rst | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/Doc/reference/expressions.rst b/Doc/reference/expressions.rst index 094b928..1cff8a5 100644 --- a/Doc/reference/expressions.rst +++ b/Doc/reference/expressions.rst @@ -326,14 +326,16 @@ range(10) for y in bar(x))``. The parentheses can be omitted on calls with only one argument. See section :ref:`calls` for details. -Since Python 3.6, if the generator appears in an :keyword:`async def` function, -then :keyword:`async for` clauses and :keyword:`await` expressions are permitted -as with an asynchronous comprehension. If a generator expression -contains either :keyword:`async for` clauses or :keyword:`await` expressions -it is called an :dfn:`asynchronous generator expression`. -An asynchronous generator expression yields a new asynchronous -generator object, which is an asynchronous iterator -(see :ref:`async-iterators`). +If a generator expression contains either :keyword:`async for` +clauses or :keyword:`await` expressions it is called an +:dfn:`asynchronous generator expression`. An asynchronous generator +expression returns a new asynchronous generator object, +which is an asynchronous iterator (see :ref:`async-iterators`). + +.. versionchanged:: 3.7 + Prior to Python 3.7, asynchronous generator expressions could + only appear in :keyword:`async def` coroutines. Starting + with 3.7, any function can use asynchronous generator expressions. .. _yieldexpr: |