mirror of
https://github.com/python/cpython.git
synced 2025-10-28 17:13:08 +00:00
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.
This commit is contained in:
parent
2b555fc1f0
commit
95f68b10d5
1 changed files with 8 additions and 8 deletions
|
|
@ -737,16 +737,16 @@ Coroutine function definition
|
||||||
keyword: await
|
keyword: await
|
||||||
|
|
||||||
Execution of Python coroutines can be suspended and resumed at many points
|
Execution of Python coroutines can be suspended and resumed at many points
|
||||||
(see :term:`coroutine`). In the body of a coroutine, any ``await`` and
|
(see :term:`coroutine`). Inside the body of a coroutine function, ``await`` and
|
||||||
``async`` identifiers become reserved keywords; :keyword:`await` expressions,
|
``async`` identifiers become reserved keywords; :keyword:`await` expressions,
|
||||||
:keyword:`async for` and :keyword:`async with` can only be used in
|
:keyword:`async for` and :keyword:`async with` can only be used in
|
||||||
coroutine bodies.
|
coroutine function bodies.
|
||||||
|
|
||||||
Functions defined with ``async def`` syntax are always coroutine functions,
|
Functions defined with ``async def`` syntax are always coroutine functions,
|
||||||
even if they do not contain ``await`` or ``async`` keywords.
|
even if they do not contain ``await`` or ``async`` keywords.
|
||||||
|
|
||||||
It is a :exc:`SyntaxError` to use ``yield from`` expressions in
|
It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the body
|
||||||
``async def`` coroutines.
|
of a coroutine function.
|
||||||
|
|
||||||
An example of a coroutine function::
|
An example of a coroutine function::
|
||||||
|
|
||||||
|
|
@ -795,8 +795,8 @@ Is semantically equivalent to::
|
||||||
|
|
||||||
See also :meth:`__aiter__` and :meth:`__anext__` for details.
|
See also :meth:`__aiter__` and :meth:`__anext__` for details.
|
||||||
|
|
||||||
It is a :exc:`SyntaxError` to use an ``async for`` statement outside of a
|
It is a :exc:`SyntaxError` to use an ``async for`` statement outside the
|
||||||
coroutine.
|
body of a coroutine function.
|
||||||
|
|
||||||
|
|
||||||
.. index:: statement: async with
|
.. index:: statement: async with
|
||||||
|
|
@ -833,8 +833,8 @@ Is semantically equivalent to::
|
||||||
|
|
||||||
See also :meth:`__aenter__` and :meth:`__aexit__` for details.
|
See also :meth:`__aenter__` and :meth:`__aexit__` for details.
|
||||||
|
|
||||||
It is a :exc:`SyntaxError` to use an ``async with`` statement outside of a
|
It is a :exc:`SyntaxError` to use an ``async with`` statement outside the
|
||||||
coroutine.
|
body of a coroutine function.
|
||||||
|
|
||||||
.. seealso::
|
.. seealso::
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue