Benchmark [was Re: common problem - elegant solution sought]

Paul Rubin http
Tue Jan 15 19:18:09 CET 2008


Helmut Jarausch <jarausch at skynet.be> writes:
> def del_by_key(L,key) :
>    for pos, (k,d) in enumerate(L):
>      if  k == key :
>        del L[pos]
>        break

This looks very dangerous, mutating L while iterating over it.



More information about the Python-list mailing list