I have always found that iterating over the indices of a list/tuple is not very clean:

for i in range(len(myList)):
    doStuff(i, myList[i])




I know I could use enumerate:

for i, v in enumerate(myList):
    doStuff(i, myList[i])

...but that stiff seems clunky.

Are there any better ways to iterate over the indices of a list /tuple?

--Bill
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to