https://github.com/python/cpython/commit/2932294c22f015d1672dbfb59692b2865d2bb983 commit: 2932294c22f015d1672dbfb59692b2865d2bb983 branch: 3.13 author: Miss Islington (bot) <[email protected]> committer: encukou <[email protected]> date: 2026-09-09T17:57:36+02:00 summary:
[3.13] gh-156837: Refer to yield expressions in generator function definitions (GH-156863) (GH-157219) (cherry picked from commit 2723799c7f357b6ba38a5cbbe96885a0a5fedacf) Co-authored-by: Lucas <[email protected]> files: M Doc/reference/datamodel.rst diff --git a/Doc/reference/datamodel.rst b/Doc/reference/datamodel.rst index ad31bd3dadd7819..3e5b7f1a0f232ff 100644 --- a/Doc/reference/datamodel.rst +++ b/Doc/reference/datamodel.rst @@ -747,12 +747,12 @@ Generator functions single: generator; function single: generator; iterator -A function or method which uses the :keyword:`yield` statement (see section -:ref:`yield`) is called a :dfn:`generator function`. Such a function, when +A function or method which contains a :keyword:`yield` expression (see section +:ref:`yieldexpr`) is called a :dfn:`generator function`. Such a function, when called, always returns an :term:`iterator` object which can be used to execute the body of the function: calling the iterator's :meth:`iterator.__next__` method will cause the function to execute until -it provides a value using the :keyword:`!yield` statement. When the +it provides a value using the :keyword:`!yield` expression. When the function executes a :keyword:`return` statement or falls off the end, a :exc:`StopIteration` exception is raised and the iterator will have reached the end of the set of values to be returned. @@ -779,7 +779,7 @@ Asynchronous generator functions single: asynchronous generator; asynchronous iterator A function or method which is defined using :keyword:`async def` and -which uses the :keyword:`yield` statement is called a +which contains a :keyword:`yield` expression is called a :dfn:`asynchronous generator function`. Such a function, when called, returns an :term:`asynchronous iterator` object which can be used in an :keyword:`async for` statement to execute the body of the function. _______________________________________________ Python-checkins mailing list -- [email protected] To unsubscribe send an email to [email protected] https://mail.python.org/mailman3//lists/python-checkins.python.org Member address: [email protected]
