On 2006-11-29, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: > Neil Cerutti wrote: >> On 2006-11-29, Roberto Bonvallet <[EMAIL PROTECTED]> wrote: >>> BTW, iterating over range(len(a)) is an anti-pattern in Python. >> >> Unless you're modifying elements of a, surely? > > enumerate is your friend :) > > for n, item in enumerate(a): > if f(item): > a[n] = whatever
I was going to bring it up but I had a brainfart about the order of (n, item) in the tuple and was too lazy to look it up. ;-) -- Neil Cerutti -- http://mail.python.org/mailman/listinfo/python-list