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

bruno.desthuilliers at gmail.com bruno.desthuilliers at gmail.com
Tue Jan 15 14:14:31 EST 2008


On Jan 15, 6:18 pm, Paul Rubin <http://phr...@NOSPAM.invalid> wrote:
> Helmut Jarausch <jarau... 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.

This would indeed be dangerous *without* the break statement !-)



More information about the Python-list mailing list