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
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to