On Tue, Jun 21, 2011 at 7:05 PM, Billy Mays <no...@nohow.com> wrote: > 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. You're not using it properly. Think about it. You're giving two names - i and v. You've forgotten about v - >>> for i, v in enumerate('fish'): ... print i, v ... 0 f 1 i 2 s 3 h HTH. -- http://mail.python.org/mailman/listinfo/python-list