Delete all items in the list

Steve Holden steve at holdenweb.com
Thu Feb 26 15:31:06 EST 2009


Terry Reedy wrote:
> 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.
> 
But shouldn't that have been lambda x: 'a' != x, which would have
invoked the string (3.0, Unicode) comparison method?

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