Benchmark [was Re: common problem
Benchmark [was Re: common problem - elegant solution sought]
bearophileHUGS at lycos.com bearophileHUGS at lycos.comTue Jan 15 11:48:30 EST 2008
- Previous message (by thread): Benchmark [was Re: common problem - elegant solution sought]
- Next message (by thread): Benchmark [was Re: common problem - elegant solution sought]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Helmut Jarausch:
> The clear winner is
>
> def del_by_key(L,key) :
> for pos, (k,d) in enumerate(L):
> if k == key :
> del L[pos]
> break
If you use Psyco this is faster:
def del_by_key(L,key):
pos = 0
for pair in L:
if pair[0] == key :
del L[pos]
break
pos += 1
Bye,
bearophile
- Previous message (by thread): Benchmark [was Re: common problem - elegant solution sought]
- Next message (by thread): Benchmark [was Re: common problem - elegant solution sought]
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list