From: Raymond Hettinger Date: Sat, 5 Oct 2002 15:38:16 +0000 (+0000) Subject: Backport 1.100: Discussion of Stop Iteration in the Iterator Protocol. X-Git-Tag: v2.2.2b1~58 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=2d4b27ea36d9c98ec52d770488801e0afb6cca84;p=thirdparty%2FPython%2Fcpython.git Backport 1.100: Discussion of Stop Iteration in the Iterator Protocol. --- diff --git a/Doc/lib/libstdtypes.tex b/Doc/lib/libstdtypes.tex index 4d659e60d11f..9d15bbd9426c 100644 --- a/Doc/lib/libstdtypes.tex +++ b/Doc/lib/libstdtypes.tex @@ -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}}