]> git.ipfire.org Git - thirdparty/Python/cpython.git/commitdiff
Backport 1.100: Discussion of Stop Iteration in the Iterator Protocol.
authorRaymond Hettinger <python@rcn.com>
Sat, 5 Oct 2002 15:38:16 +0000 (15:38 +0000)
committerRaymond Hettinger <python@rcn.com>
Sat, 5 Oct 2002 15:38:16 +0000 (15:38 +0000)
Doc/lib/libstdtypes.tex

index 4d659e60d11f4fa0eb55446a1ef14a9f044bbfe5..9d15bbd9426c26e6899ddc230ecc37e02ce302ca 100644 (file)
@@ -367,6 +367,13 @@ general and specific sequence types, dictionaries, and other more
 specialized forms.  The specific types are not important beyond their
 implementation of the iterator protocol.
 
+The intention of the protocol is that once an iterator's
+\method{next()} method raises \exception{StopIteration}, it will
+continue to do so on subsequent calls.  Implementations that
+do not obey this property are deemed broken.  (This constraint
+was added in Python 2.3; in Python 2.2, various iterators are
+broken according to this rule.)
+
 
 \subsection{Sequence Types \label{typesseq}}