functools.partial (was: Delete all items in the list)

John Posner jjposner at snet.net
Thu Feb 26 10:52:19 EST 2009


 >> 
 >>  from functools import partial
 >>  from operator import ne
 >> L = filter(partial(ne, 'a'), L)
 >> 

I learned about functools.partial only recently (on this list). functools is
implemented in C, not Python, so I couldn't answer this question for myself:

  Is functools.partial completely equivalent to a manually-coded closure?

Help, please.

-John





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



More information about the Python-list mailing list