Delete all items in the list

Steve Holden steve at holdenweb.com
Thu Feb 26 13:42:51 EST 2009


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?

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
-- 
Steve Holden        +1 571 484 6266   +1 800 494 3119
Holden Web LLC              http://www.holdenweb.com/




More information about the Python-list mailing list