summaryrefslogtreecommitdiff
path: root/Doc/howto/functional.rst
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-09 11:44:30 -0400
committerYury Selivanov <yselivanov@sprymix.com>2015-05-09 11:44:30 -0400
commit8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26 (patch)
treed6353155110b49bf7953fd0d7d3f808512e8feb1 /Doc/howto/functional.rst
parentbd60e8dece89440ebdc80a19b2217d5ba2515124 (diff)
downloadcpython-git-8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26.tar.gz
PEP 479: Change StopIteration handling inside generators.
Closes issue #22906.
Diffstat (limited to 'Doc/howto/functional.rst')
-rw-r--r--Doc/howto/functional.rst8
1 files changed, 4 insertions, 4 deletions
diff --git a/Doc/howto/functional.rst b/Doc/howto/functional.rst
index 1969b32108..945a240666 100644
--- a/Doc/howto/functional.rst
+++ b/Doc/howto/functional.rst
@@ -481,10 +481,10 @@ Here's a sample usage of the ``generate_ints()`` generator:
You could equally write ``for i in generate_ints(5)``, or ``a,b,c =
generate_ints(3)``.
-Inside a generator function, ``return value`` is semantically equivalent to
-``raise StopIteration(value)``. If no value is returned or the bottom of the
-function is reached, the procession of values ends and the generator cannot
-return any further values.
+Inside a generator function, ``return value`` causes ``StopIteration(value)``
+to be raised from the :meth:`~generator.__next__` method. Once this happens, or
+the bottom of the function is reached, the procession of values ends and the
+generator cannot yield any further values.
You could achieve the effect of generators manually by writing your own class
and storing all the local variables of the generator as instance variables. For