[Python-checkins] CVS: python/dist/src/Doc/lib libfuncs.tex,1.83,1.84

Fred L. Drake fdrake@users.sourceforge.net
2001年9月06日 12:04:31 -0700


Update of /cvsroot/python/python/dist/src/Doc/lib
In directory usw-pr-cvs1:/tmp/cvs-serv4263/lib
Modified Files:
	libfuncs.tex 
Log Message:
Document the built-in iter() function.
Index: libfuncs.tex
===================================================================
RCS file: /cvsroot/python/python/dist/src/Doc/lib/libfuncs.tex,v
retrieving revision 1.83
retrieving revision 1.84
diff -C2 -d -r1.83 -r1.84
*** libfuncs.tex	2001年09月03日 08:35:40	1.83
--- libfuncs.tex	2001年09月06日 19:04:29	1.84
***************
*** 391,394 ****
--- 391,411 ----
 \end{funcdesc}
 
+ \begin{funcdesc}{iter}{o\optional{, sentinel}}
+ Return an iterator object. The first argument is interpreted very
+ differently depending on the presence of the second argument.
+ Without a second argument, \var{o} must be a collection object which
+ supports the iteration protocol (the \method{__iter__()} method), or
+ it must support the sequence protocol (the \method{__getitem__()}
+ method with integer arguments starting at \code{0}). If it does not
+ support either of those protocols, \exception{TypeError} is raised.
+ If the second argument, \var{sentinel}, is given, then \var{o} must
+ be a callable object. The iterator created in this case will call
+ \var{o} with no arguments for each call to its \method{next()}
+ method; if the value returned is equal to \var{sentinel},
+ \exception{StopIteration} will be raised, otherwise the value will
+ be returned.
+ \versionadded{2.2}
+ \end{funcdesc}
+ 
 \begin{funcdesc}{len}{s}
 Return the length (the number of items) of an object. The argument

AltStyle によって変換されたページ (->オリジナル) /