diff options
author | Andrés Delfino <adelfino@gmail.com> | 2018-10-28 10:41:57 (GMT) |
---|---|---|
committer | Miss Islington (bot) <31488909+miss-islington@users.noreply.github.com> | 2018-10-28 10:41:57 (GMT) |
commit | 95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c (patch) | |
tree | 01fdd031766396444b2ace9548d00a61ceb42b89 /Doc | |
parent | 2b555fc1f07bee8b066a6d7da727e516f37e8e34 (diff) | |
download | cpython-95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c.zip cpython-95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c.tar.gz cpython-95f68b10d5c9852ef4dcf5b9f2ae15fdf74e8f1c.tar.bz2 |
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.
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/reference/compound_stmts.rst | 16 |
1 files changed, 8 insertions, 8 deletions
diff --git a/Doc/reference/compound_stmts.rst b/Doc/reference/compound_stmts.rst index 592d6ca..fe745ee 100644 --- a/Doc/reference/compound_stmts.rst +++ b/Doc/reference/compound_stmts.rst @@ -737,16 +737,16 @@ Coroutine function definition keyword: await 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, :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, even if they do not contain ``await`` or ``async`` keywords. -It is a :exc:`SyntaxError` to use ``yield from`` expressions in -``async def`` coroutines. +It is a :exc:`SyntaxError` to use a ``yield from`` expression inside the body +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. -It is a :exc:`SyntaxError` to use an ``async for`` statement outside of a -coroutine. +It is a :exc:`SyntaxError` to use an ``async for`` statement outside the +body of a coroutine function. .. index:: statement: async with @@ -833,8 +833,8 @@ Is semantically equivalent to:: See also :meth:`__aenter__` and :meth:`__aexit__` for details. -It is a :exc:`SyntaxError` to use an ``async with`` statement outside of a -coroutine. +It is a :exc:`SyntaxError` to use an ``async with`` statement outside the +body of a coroutine function. .. seealso:: |