Message134290
Note: 3.x correct gives the signature at enumerate(iterable, start) rather that enumerate(sequence, start).
I agree that the current entry is a bit awkward. Perhaps the doc would be clearer with a reference to zipping. Removing the unneeded definition of *iterable* (which should be linked to the definition in the glossary, along with *iterator*), my suggestion is:
'''
enumerate(iterable, start=0)
Return an enumerate object, an *iterator* of tuples, that zips together a sequence of counts and *iterable*. Each tuple contain a count and an item from *iterable*, in that order. The counts begin with *start*, which defaults to 0. enumerate() is useful for obtaining an indexed series: enumerate(seq) produces (0, seq[0]), (1, seq[1]), (2, seq[2]), .... For another example, which uses *start*:
>>> for i, season in enumerate(['Spring','Summer','Fall','Winter'], 1):
... print(i, season)
1 Spring
2 Summer
3 Fall
4 Winter
'''
Note that I changed the example to use a start of 1 instead of 0, to produce a list in traditional form, which is one reason to have the parameter! |
|
Date |
User |
Action |
Args |
2011-04-23 01:31:47 | terry.reedy | set | recipients:
+ terry.reedy, rhettinger, r.david.murray, phammer |
2011-04-23 01:31:47 | terry.reedy | set | messageid: <1303522307.14.0.324299016663.issue11889@psf.upfronthosting.co.za> |
2011-04-23 01:31:46 | terry.reedy | link | issue11889 messages |
2011-04-23 01:31:45 | terry.reedy | create | |
|