[docs] [issue22725] improve documentation for enumerate() (built-in function)

Raymond Hettinger report at bugs.python.org
Sat Nov 1 02:04:22 CET 2014


Raymond Hettinger added the comment:

The "sequence" parameter name is an unfortunate hold-over from olden times were many things that accepted iterables were marked as taking sequences.

This was fixed in Python 3, but it can't be changed in Py2.7 because the parameter name is exposed as a keyword argument:

    >>> list(enumerate(sequence='abc', start=2))
    [(2, 'a'), (3, 'b'), (4, 'c')]

The rest docs for Python 2.7 read just fine, "Return an enumerate object. sequence must be a sequence, an iterator, or some other object which supports iteration."   I think that is sufficient to clarify any confusion caused by the unfortunate choice of keyword argument name.

----------
assignee: docs at python -> rhettinger
nosy: +rhettinger
resolution:  -> rejected
status: open -> closed
versions:  -Python 3.4, Python 3.5

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue22725>
_______________________________________


More information about the docs mailing list