Oleg> NEVER, I said NEVER modify the list while running through it!
Never say "never". ;-)
This works just fine:
>>> foo = [1,2,3,4,5]
>>> for i in range(len(foo)-1,-1,-1):
... del foo[i]
...
>>> foo
[]
--
Skip Montanaro (skip at pobox.com)
http://www.mojam.com/
http://www.musi-cal.com/