diff options
| author | Nick Coghlan <ncoghlan@gmail.com> | 2012-01-13 21:43:40 +1000 |
|---|---|---|
| committer | Nick Coghlan <ncoghlan@gmail.com> | 2012-01-13 21:43:40 +1000 |
| commit | 1f7ce62bd61488d5d721896a36a1b43befab88b5 (patch) | |
| tree | e7c92d4429ce431c78d0b7816c93862629590223 /Doc/library/exceptions.rst | |
| parent | e51757f6de9db71b7ee0a6cbf7dde62e9f146804 (diff) | |
| download | cpython-git-1f7ce62bd61488d5d721896a36a1b43befab88b5.tar.gz | |
Implement PEP 380 - 'yield from' (closes #11682)
Diffstat (limited to 'Doc/library/exceptions.rst')
| -rw-r--r-- | Doc/library/exceptions.rst | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/Doc/library/exceptions.rst b/Doc/library/exceptions.rst index 49cec1ec0c..a9a16d3d9a 100644 --- a/Doc/library/exceptions.rst +++ b/Doc/library/exceptions.rst @@ -250,7 +250,16 @@ The following exceptions are the exceptions that are usually raised. .. exception:: StopIteration Raised by built-in function :func:`next` and an :term:`iterator`\'s - :meth:`__next__` method to signal that there are no further values. + :meth:`__next__` method to signal that there are no further items to be + produced by the iterator. + + The exception object has a single attribute :attr:`value`, which is + given as an argument when constructing the exception, and defaults + to :const:`None`. + + When a generator function returns, a new :exc:`StopIteration` instance is + raised, and the value returned by the function is used as the + :attr:`value` parameter to the constructor of the exception. .. exception:: SyntaxError |
