Skip to content

Commit 91313af

Browse files
authored
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (#121175)
1 parent d44c550 commit 91313af

File tree

1 file changed

+6
-4
lines changed

1 file changed

+6
-4
lines changed

Doc/reference/expressions.rst

+6-4
Original file line numberDiff line numberDiff line change
@@ -218,10 +218,12 @@ A comprehension in an :keyword:`!async def` function may consist of either a
218218
:keyword:`!for` or :keyword:`!async for` clause following the leading
219219
expression, may contain additional :keyword:`!for` or :keyword:`!async for`
220220
clauses, and may also use :keyword:`await` expressions.
221-
If a comprehension contains either :keyword:`!async for` clauses or
222-
:keyword:`!await` expressions or other asynchronous comprehensions it is called
223-
an :dfn:`asynchronous comprehension`. An asynchronous comprehension may
224-
suspend the execution of the coroutine function in which it appears.
221+
222+
If a comprehension contains :keyword:`!async for` clauses, or if it contains
223+
:keyword:`!await` expressions or other asynchronous comprehensions anywhere except
224+
the iterable expression in the leftmost :keyword:`!for` clause, it is called an
225+
:dfn:`asynchronous comprehension`. An asynchronous comprehension may suspend the
226+
execution of the coroutine function in which it appears.
225227
See also :pep:`530`.
226228

227229
.. versionadded:: 3.6

0 commit comments

Comments
 (0)