Skip to content

Commit 55274ec

Browse files
committed
gh-156837: Refer to yield expressions in generator function definitions
1 parent 5056ac5 commit 55274ec

1 file changed

Lines changed: 4 additions & 4 deletions

File tree

Doc/reference/datamodel.rst

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -798,12 +798,12 @@ Generator functions
798798
single: generator; function
799799
single: generator; iterator
800800

801-
A function or method which uses the :keyword:`yield` statement (see section
802-
:ref:`yield`) is called a :dfn:`generator function`. Such a function, when
801+
A function or method which contains a :keyword:`yield` expression (see section
802+
:ref:`yieldexpr`) is called a :dfn:`generator function`. Such a function, when
803803
called, always returns an :term:`iterator` object which can be used to
804804
execute the body of the function: calling the iterator's
805805
:meth:`iterator.__next__` method will cause the function to execute until
806-
it provides a value using the :keyword:`!yield` statement. When the
806+
it provides a value using the :keyword:`!yield` expression. When the
807807
function executes a :keyword:`return` statement or falls off the end, a
808808
:exc:`StopIteration` exception is raised and the iterator will have
809809
reached the end of the set of values to be returned.
@@ -830,7 +830,7 @@ Asynchronous generator functions
830830
single: asynchronous generator; asynchronous iterator
831831

832832
A function or method which is defined using :keyword:`async def` and
833-
which uses the :keyword:`yield` statement is called a
833+
which contains a :keyword:`yield` expression is called a
834834
:dfn:`asynchronous generator function`. Such a function, when called,
835835
returns an :term:`asynchronous iterator` object which can be used in an
836836
:keyword:`async for` statement to execute the body of the function.

0 commit comments

Comments
 (0)