summaryrefslogtreecommitdiffstats
path: root/Doc/howto
diff options
context:
space:
mode:
authorYury Selivanov <yselivanov@sprymix.com>2015-05-09 15:44:30 (GMT)
committerYury Selivanov <yselivanov@sprymix.com>2015-05-09 15:44:30 (GMT)
commit8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26 (patch)
treed6353155110b49bf7953fd0d7d3f808512e8feb1 /Doc/howto
parentbd60e8dece89440ebdc80a19b2217d5ba2515124 (diff)
downloadcpython-8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26.zip
cpython-8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26.tar.gz
cpython-8170e8c0d12cb9414f3a3d3ca81a447b4afc5f26.tar.bz2
PEP 479: Change StopIteration handling inside generators.
Closes issue #22906.
Diffstat (limited to 'Doc/howto')
-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 1969b32..945a240 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