Performance of list vs. set equality operations

Patrick Maupin pmaupin at gmail.com
Fri Apr 9 02:02:23 CEST 2010


On Apr 8, 6:35 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:

> The CPython source contains lots of shortcuts like that. Perhaps the  
> checks should be stricter in some cases, but I imagine it's not so easy to  
> fix: lots of code was written in the pre-2.2 era, assuming that internal  
> types were not subclassable.

I don't know if it's a good "fix" anyway.  If you subclass an internal
type, you can certainly supply your own rich comparison methods, which
would (IMO) put the CPU computation burden where it belongs if you
decide to do something goofy like subclass a list and then override
__len__.

Regards,
Pat



More information about the Python-list mailing list