PEP 276 Simple Iterator for ints (fwd)

Paul Rubin phr-n2001d at
Thu Nov 15 01:31:28 CET 2001

David Eppstein <eppstein at> writes:
> > 
> >     for i in 0 .. len(sequence)-1:
> This is very common in C, but is it so common in Python?
> Isn't it usually more idiomatic to do
>     for item in sequence
> ?

Sometimes you want to use the index in the loop.  Maybe the loop syntax
should be extended somehow to easily let you do that.

More information about the Python-list mailing list