PEP 276 Simple Iterator for ints (fwd)
huaiyu at gauss.almadan.ibm.com
Thu Nov 15 20:27:23 CET 2001
On 14 Nov 2001 16:31:28 -0800, Paul Rubin <phr-n2001d at nightsong.com> wrote:
>Sometimes you want to use the index in the loop. Maybe the loop syntax
>should be extended somehow to easily let you do that.
return zip(range(len(x)), x)
for i, x in items(sequence):
If there were an xzip for iterators, and an int-generator xint, then we
return xzip(xint(), x)
which would work for an iterator x without knowing its length beforehand.
More information about the Python-list