diff options
author | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
---|---|---|
committer | Georg Brandl <georg@python.org> | 2007-04-21 15:47:16 (GMT) |
commit | a18af4e7a2091d11478754eb66ae387a85535763 (patch) | |
tree | fea8015d656cfee937bb6f3d106e6ca0e9f19d78 /Doc/tut/glossary.tex | |
parent | 4d2adcca52ced412d4bdf131b872729c43520d58 (diff) | |
download | cpython-a18af4e7a2091d11478754eb66ae387a85535763.zip cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.gz cpython-a18af4e7a2091d11478754eb66ae387a85535763.tar.bz2 |
PEP 3114: rename .next() to .__next__() and add next() builtin.
Diffstat (limited to 'Doc/tut/glossary.tex')
-rw-r--r-- | Doc/tut/glossary.tex | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Doc/tut/glossary.tex b/Doc/tut/glossary.tex index 738e12d..a19416b 100644 --- a/Doc/tut/glossary.tex +++ b/Doc/tut/glossary.tex @@ -117,7 +117,7 @@ contain one or more {}\keyword{for} or \keyword{while} loops that \keyword{yield} elements back to the caller. The function execution is stopped at the {}\keyword{yield} keyword (returning the result) and is resumed there when the next element is requested by calling the -\method{next()} method of the returned iterator. +\method{__next__()} method of the returned iterator. \index{generator expression} \item[generator expression] @@ -207,10 +207,10 @@ hold the iterator for the duration of the loop. See also \index{iterator} \item[iterator] An object representing a stream of data. Repeated calls to the -iterator's \method{next()} method return successive items in the +iterator's \method{__next__()} method return successive items in the stream. When no more data is available a \exception{StopIteration} exception is raised instead. At this point, the iterator object is -exhausted and any further calls to its \method{next()} method just +exhausted and any further calls to its \method{__next__()} method just raise \exception{StopIteration} again. Iterators are required to have an \method{__iter__()} method that returns the iterator object itself so every iterator is also iterable and may be used in most |