Steven D'Aprano wrote: > On Wed, 29 Nov 2006 17:00:30 +0100, Fredrik Lundh wrote: > >> Neil Cerutti wrote: >> >>>> BTW, iterating over range(len(a)) is an anti-pattern in Python. >>> >>> Unless you're modifying elements of a, surely? >> >> and needs to run on a Python version that doesn't support enumerate. > > This isn't meant as an argument against using enumerate in the common > case, but there are circumstances where iterating with an index variable > is the right thing to do. "Anti-pattern" tends to imply that it is always > wrong.
Right, I should have said: "iterating over range(len(a)) just to obtain the elements of a is not the pythonic way to do it". Cheers, -- Roberto Bonvallet -- http://mail.python.org/mailman/listinfo/python-list
