Skip to content

Commit 95f68b1

Browse files
andresdelfinomiss-islington
authored andcommitted
Fix mistakes on function coroutines related definitions (GH-9871)
Fix a bug I introduced in #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.
1 parent 2b555fc commit 95f68b1

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
@@ -737,16 +737,16 @@ Coroutine function definition
737737
keyword: await
738738

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

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

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

751751
An example of a coroutine function::
752752

@@ -795,8 +795,8 @@ Is semantically equivalent to::
795795

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

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

801801

802802
.. index:: statement: async with
@@ -833,8 +833,8 @@ Is semantically equivalent to::
833833

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

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

839839
.. seealso::
840840

0 commit comments

Comments
 (0)