Skip to content

Fix mistakes on function coroutines related definitions #9871

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Oct 28, 2018
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 8 additions & 8 deletions Doc/reference/compound_stmts.rst
Original file line number Diff line number Diff line change
Expand Up @@ -707,16 +707,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::

Expand Down Expand Up @@ -765,8 +765,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
Expand Down Expand Up @@ -803,8 +803,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::

Expand Down