PEP 284, Integer for-loops (code bash?)
David Eppstein
eppstein at ics.uci.edu
Fri Mar 8 11:57:42 EST 2002
In article <mailman.1015594994.21811.python-list at python.org>,
Laura Creighton <lac at strakt.com> wrote:
> By the way, for your students, what keeps you from doing this:
...
> for index, value in zip(_indices, someList):
> whatever_you_want()
I find "for i in range(len(list))" adequate for looping over indices of
a list.
But much of the time, when I want to loop over integers, it's part of
some dynamic program where the integers I want to loop over aren't the
index set of any list, are in backwards order, aren't half-open
intervals, etc., and the range syntax becomes more cumbersome.
More information about the Python-list
mailing list