>> 
 >> > L = filter('a'.__ne__,L)
 >> 
 >> And this is probably the fastest. But not all types define 
 >> __ne__ so a  
 >> more generic answer would be:
 >> 
 >>  from functools import partial
 >>  from operator import ne
 >> L = filter(partial(ne, 'a'), L)
 >> 

And don't forget this "traditional" solution:

>>> L=['a', 'b', 'c', 'a']
>>> filter(lambda arg: arg != 'a', L)
['b', 'c']

-John





E-mail message checked by Spyware Doctor (6.0.0.386)
Database version: 5.11850
http://www.pctools.com/en/spyware-doctor-antivirus/
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to