summaryrefslogtreecommitdiffstats
path: root/Doc/lib
diff options
context:
space:
mode:
authorFred Drake <fdrake@acm.org>2002-04-26 20:29:44 (GMT)
committerFred Drake <fdrake@acm.org>2002-04-26 20:29:44 (GMT)
commit38f71973e52f59e51c8676299f44f829408699ff (patch)
tree06ef5c6c9cf4537ccb47b0da3b20fe1822566bab /Doc/lib
parent26dd830123413207ca816377bb934a15d2e1b215 (diff)
downloadcpython-38f71973e52f59e51c8676299f44f829408699ff.zip
cpython-38f71973e52f59e51c8676299f44f829408699ff.tar.gz
cpython-38f71973e52f59e51c8676299f44f829408699ff.tar.bz2
Documentation for the enumerate() function/type.
This closes SF patch #547162.
Diffstat (limited to 'Doc/lib')
-rw-r--r--Doc/lib/libfuncs.tex12
1 files changed, 12 insertions, 0 deletions
diff --git a/Doc/lib/libfuncs.tex b/Doc/lib/libfuncs.tex
index 3192a17..c7bb5a6 100644
--- a/Doc/lib/libfuncs.tex
+++ b/Doc/lib/libfuncs.tex
@@ -261,6 +261,18 @@ def my_import(name):
\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