This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients ncoghlan, rhettinger, scott.dial
Date 2008-05-13.09:49:59
SpamBayes Score 0.0017352027
Marked as misclassified No
Message-id <1210672206.04.0.902040783221.issue2831@psf.upfronthosting.co.za>
In-reply-to
Content
Note that this functionality is currently available as follows:

>>> from itertools import count
>>> list(zip(count(3), 'abcdefg')
[(3, 'a'), (4, 'b'), (5, 'c'), (6, 'd'), (7, 'e'), (8, 'f'), (9, 'g')]

The enumerate(itr) builtin is just a convenience to avoid a module
import for the most basic zip(count(), itr) version.

The proposed patch would enable the example above to be written more
verbosely as:

>>> list(enumerate('abcdefg', start=3))

Or, with the positional argument approach as:

>>> list(enumerate(3, 'abcdefg'))


So, more verbose than the existing approach, and ambiguous to boot - as
Raymond noted, with the first it really isn't clear whether the first
value returned would be (3, 'd') or (3, 'a'), and with the second form
it isn't clear whether we're skipping the first three items, or
returning only those items.

Let's keep the builtins simple, and let itertools handle the variants -
that's why the module exists.
History
Date User Action Args
2008-05-13 09:50:06ncoghlansetspambayes_score: 0.0017352 -> 0.0017352027
recipients: + ncoghlan, rhettinger, scott.dial
2008-05-13 09:50:06ncoghlansetspambayes_score: 0.0017352 -> 0.0017352
messageid: <1210672206.04.0.902040783221.issue2831@psf.upfronthosting.co.za>
2008-05-13 09:50:04ncoghlanlinkissue2831 messages
2008-05-13 09:50:01ncoghlancreate