File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -390,6 +390,23 @@ \section{Built-in Functions \label{built-in-funcs}}
390390raised.
391391\end {funcdesc }
392392
393+ \begin {funcdesc }{iter}{o\optional {, sentinel}}
394+ Return an iterator object. The first argument is interpreted very
395+ differently depending on the presence of the second argument.
396+ Without a second argument, \var {o} must be a collection object which
397+ supports the iteration protocol (the \method {__iter__()} method), or
398+ it must support the sequence protocol (the \method {__getitem__()}
399+ method with integer arguments starting at \code {0}). If it does not
400+ support either of those protocols, \exception {TypeError} is raised.
401+ If the second argument, \var {sentinel}, is given, then \var {o} must
402+ be a callable object. The iterator created in this case will call
403+ \var {o} with no arguments for each call to its \method {next()}
404+ method; if the value returned is equal to \var {sentinel},
405+ \exception {StopIteration} will be raised, otherwise the value will
406+ be returned.
407+ \versionadded {2.2}
408+ \end {funcdesc }
409+
393410\begin {funcdesc }{len}{s}
394411 Return the length (the number of items) of an object. The argument
395412 may be a sequence (string, tuple or list) or a mapping (dictionary).
You can’t perform that action at this time.
0 commit comments