Skip to content

Commit 50e04cc

Browse files
Fix mistakes on function coroutines related definitions (GH-9871)
Fix a bug I introduced in GH-9864 by which coroutines are treated as synonymous of function coroutines. Also, fix the same mistake (coroutines == function coroutines) already present in other parts of the reference. I'm very sorry for the hassle. (cherry picked from commit 95f68b1) Co-authored-by: Andrés Delfino <[email protected]>
1 parent 593af34 commit 50e04cc

File tree

1 file changed

+8
-8
lines changed

1 file changed

+8
-8
lines changed

Doc/reference/compound_stmts.rst

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -736,16 +736,16 @@ Coroutine function definition
736736
keyword: await
737737

738738
Execution of Python coroutines can be suspended and resumed at many points
739-
(see :term:`coroutine`). In the body of a coroutine, any ``await`` and
739+
(see :term:`coroutine`). Inside the body of a coroutine function, ``await`` and
740740
``async`` identifiers become reserved keywords; :keyword:`await` expressions,
741741
:keyword:`async for` and :keyword:`async with` can only be used in
742-
coroutine bodies.
742+
coroutine function bodies.
743743

744744
Functions defined with ``async def`` syntax are always coroutine functions,
745745
even if they do not contain ``await`` or ``async`` keywords.
746746

747-
It is a :exc:`SyntaxError` to use ``yield from`` expressions in
748-
``async def`` coroutines.
747+
It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the body
748+
of a coroutine function.
749749

750750
An example of a coroutine function::
751751

@@ -794,8 +794,8 @@ Is semantically equivalent to::
794794

795795
See also :meth:`__aiter__` and :meth:`__anext__` for details.
796796

797-
It is a :exc:`SyntaxError` to use an ``async for`` statement outside of a
798-
coroutine.
797+
It is a :exc:`SyntaxError` to use an ``async for`` statement outside the
798+
body of a coroutine function.
799799

800800

801801
.. index:: statement: async with
@@ -832,8 +832,8 @@ Is semantically equivalent to::
832832

833833
See also :meth:`__aenter__` and :meth:`__aexit__` for details.
834834

835-
It is a :exc:`SyntaxError` to use an ``async with`` statement outside of a
836-
coroutine.
835+
It is a :exc:`SyntaxError` to use an ``async with`` statement outside the
836+
body of a coroutine function.
837837

838838
.. seealso::
839839

0 commit comments

Comments
 (0)