]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
gh-114104: clarify asynchronous comprehension docs to match runtime behavior (#121175)
authorDanny Yang <yangdanny97@users.noreply.github.com>
Mon, 1 Jul 2024 16:34:39 +0000 (12:34 -0400)
committerGitHub <noreply@github.com>
Mon, 1 Jul 2024 16:34:39 +0000 (22:04 +0530)
Doc/reference/expressions.rst

index 872773f4d2823564701acf54e340aaf6d12e272d..95ece0e1608dcc0428e2278b7286a25be57d7326 100644 (file)
@@ -218,10 +218,12 @@ 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 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.
+
+If a comprehension contains :keyword:`!async for` clauses, or if it contains
+:keyword:`!await` expressions or other asynchronous comprehensions anywhere except
+the iterable expression in the leftmost :keyword:`!for` clause, 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`.
 
 .. versionadded:: 3.6