Message66776
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. |
|
| Date |
User |
Action |
Args |
| 2008-05-13 09:50:06 | ncoghlan | set | spambayes_score: 0.0017352 -> 0.0017352 recipients:
+ ncoghlan, rhettinger, scottdial |
| 2008-05-13 09:50:06 | ncoghlan | set | spambayes_score: 0.0017352 -> 0.0017352 messageid: <1210672206.04.0.902040783221.issue2831@psf.upfronthosting.co.za> |
| 2008-05-13 09:50:04 | ncoghlan | link | issue2831 messages |
| 2008-05-13 09:50:01 | ncoghlan | create | |
|