| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -747,12 +747,12 @@ Generator functions | |||
| 747 | 747 | single: generator; function | |
| 748 | 748 | single: generator; iterator | |
| 749 | 749 | ||
| 750 | - A function or method which uses the :keyword:`yield` statement (see section | ||
| 751 | - :ref:`yield`) is called a :dfn:`generator function`. Such a function, when | ||
| 750 | + A function or method which contains a :keyword:`yield` expression (see section | ||
| 751 | + :ref:`yieldexpr`) is called a :dfn:`generator function`. Such a function, when | ||
| 752 | 752 | called, always returns an :term:`iterator` object which can be used to | |
| 753 | 753 | execute the body of the function: calling the iterator's | |
| 754 | 754 | :meth:`iterator.__next__` method will cause the function to execute until | |
| 755 | - it provides a value using the :keyword:`!yield` statement. When the | ||
| 755 | + it provides a value using the :keyword:`!yield` expression. When the | ||
| 756 | 756 | function executes a :keyword:`return` statement or falls off the end, a | |
| 757 | 757 | :exc:`StopIteration` exception is raised and the iterator will have | |
| 758 | 758 | reached the end of the set of values to be returned. | |
@@ -779,7 +779,7 @@ Asynchronous generator functions | |||
| 779 | 779 | single: asynchronous generator; asynchronous iterator | |
| 780 | 780 | ||
| 781 | 781 | A function or method which is defined using :keyword:`async def` and | |
| 782 | - which uses the :keyword:`yield` statement is called a | ||
| 782 | + which contains a :keyword:`yield` expression is called a | ||
| 783 | 783 | :dfn:`asynchronous generator function`. Such a function, when called, | |
| 784 | 784 | returns an :term:`asynchronous iterator` object which can be used in an | |
| 785 | 785 | :keyword:`async for` statement to execute the body of the function. | |
| Back | FazBrowse Home | New Git URL |
0 commit comments