Steve Holden wrote:
Terry Reedy wrote:
Gabriel Genellina wrote:
L = filter('a'.__ne__,L)
And this is probably the fastest. But not all types define __ne__
In Py3, all classes inherit .__ne__ from 'object'.
Isn't that inherited method just an identity comparison?
Yes. And so is, by default, the snipped slower proposed alternative of
lambda x: a!= x.
However in this particular case the main point is that str *does*
implement __ne__. So as long as that built-in method doesn't call the
other operand's __ne__ there should be no problem.
regards
Steve
--
http://mail.python.org/mailman/listinfo/python-list