PEP 276 Simple Iterator for ints (fwd)

Paul Rubin phr-n2001d at nightsong.com
Wed Nov 14 19:31:28 EST 2001


David Eppstein <eppstein at ics.uci.edu> 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