diff Doc/lib/libfuncs.tex @ 23287:b60b73d41eb4 legacy-trunk

Documentation for the enumerate() function/type. This closes SF patch #547162.
author Fred Drake <fdrake@acm.org>
date Fri, 26 Apr 2002 20:29:44 +0000
parents 7b00dab988cf
children dba4f5176492
line wrap: on
line diff
--- a/Doc/lib/libfuncs.tex	Fri Apr 26 20:11:29 2002 +0000
+++ b/Doc/lib/libfuncs.tex	Fri Apr 26 20:29:44 2002 +0000
@@ -261,6 +261,18 @@
   \var{b}, and \code{0 <= abs(\var{a} \%{} \var{b}) < abs(\var{b})}.
 \end{funcdesc}
 
+\begin{funcdesc}{enumerate}{iterable}
+  Return an enumerate object. \var{iterable} must be a sequence, an
+  iterator, or some other object which supports iteration.  The
+  \method{next()} method of the iterator returned by
+  \function{enumerate()} returns a tuple containing a count (from
+  zero) and the corresponding value obtained from iterating over
+  \var{iterable}.  \function{enumerate} is useful for obtaining an
+  indexed series: \code{(0, seq[0])}, \code{(1, seq[1])}, \code{(2,
+  seq[2])}, \ldots.
+  \versionadded{2.3}
+\end{funcdesc}
+
 \begin{funcdesc}{eval}{expression\optional{, globals\optional{, locals}}}
   The arguments are a string and two optional dictionaries.  The
   \var{expression} argument is parsed and evaluated as a Python