summaryrefslogtreecommitdiffstats
path: root/Doc
diff options
context:
space:
mode:
authorGeorg Brandl <georg@python.org>2008-05-13 19:04:54 (GMT)
committerGeorg Brandl <georg@python.org>2008-05-13 19:04:54 (GMT)
commit913835763a4734097423c49e284ce8d4b1093917 (patch)
tree500df9f02e13104b9c00d9f07541ab324abc1a29 /Doc
parentef9764f1a479808b340c16bcfdb0cd6838465ea9 (diff)
downloadcpython-913835763a4734097423c49e284ce8d4b1093917.zip
cpython-913835763a4734097423c49e284ce8d4b1093917.tar.gz
cpython-913835763a4734097423c49e284ce8d4b1093917.tar.bz2
#2831: add start argument to enumerate(). Patch by Scott Dial and me.
Diffstat (limited to 'Doc')
-rw-r--r--Doc/library/functions.rst12
1 files changed, 7 insertions, 5 deletions
diff --git a/Doc/library/functions.rst b/Doc/library/functions.rst
index bc07d84..6de9392 100644
--- a/Doc/library/functions.rst
+++ b/Doc/library/functions.rst
@@ -335,15 +335,15 @@ available. They are listed here in alphabetical order.
Using :func:`divmod` with complex numbers is deprecated.
-.. function:: enumerate(sequence)
+.. function:: enumerate(sequence[, start=0])
Return an enumerate object. *sequence* must be a sequence, an
:term:`iterator`, or some other object which supports iteration. The
:meth:`next` method of the iterator returned by :func:`enumerate` returns a
- tuple containing a count (from zero) and the corresponding value obtained
- from iterating over *iterable*. :func:`enumerate` is useful for obtaining an
- indexed series: ``(0, seq[0])``, ``(1, seq[1])``, ``(2, seq[2])``, .... For
- example:
+ tuple containing a count (from *start* which defaults to 0) and the
+ corresponding value obtained from iterating over *iterable*.
+ :func:`enumerate` is useful for obtaining an indexed series: ``(0, seq[0])``,
+ ``(1, seq[1])``, ``(2, seq[2])``, .... For example:
>>> for i, season in enumerate(['Spring', 'Summer', 'Fall', 'Winter']):
... print i, season
@@ -353,6 +353,8 @@ available. They are listed here in alphabetical order.
3 Winter
.. versionadded:: 2.3
+ .. versionadded:: 2.6
+ The *start* parameter.
.. function:: eval(expression[, globals[, locals]])