]> granicus.if.org Git - python/commitdiff
Record the decision that StopIteration is a sink state (see recent
authorGuido van Rossum <guido@python.org>
Tue, 16 Jul 2002 19:53:39 +0000 (19:53 +0000)
committerGuido van Rossum <guido@python.org>
Tue, 16 Jul 2002 19:53:39 +0000 (19:53 +0000)
discussion in python-dev with subject "Termination of two-arg iter()").

Implementation will follow.

Doc/lib/libstdtypes.tex

index 1a07d3c984163637a8c987e3ecf3e61373827eb8..aabc9bfa48810b029ec0031a33ef5109686465b6 100644 (file)
@@ -377,6 +377,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}}