trouble writing results to files

Roberto Bonvallet Roberto.Bonvallet at cern.ch
Wed Nov 29 16:35:37 CET 2006


Neil Cerutti wrote:
> On 2006-11-29, Roberto Bonvallet <Roberto.Bonvallet at cern.ch> 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

-- 
Roberto Bonvallet



More information about the Python-list mailing list