Performance of list vs. set equality operations

Patrick Maupin pmaupin at gmail.com
Fri Apr 9 14:41:39 EDT 2010


On Apr 9, 1:07 pm, "Gabriel Genellina" <gagsl-... at yahoo.com.ar> wrote:
> En Thu, 08 Apr 2010 21:02:23 -0300, Patrick Maupin <pmau... at gmail.com>  
> escribió:
>
> > 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__.
>
> We're all consenting adults, that's the Python philosophy, isn't it?
> If I decide to make stupid things, it's my fault. I don't see why Python  
> should have to prevent that.
>
> --
> Gabriel Genellina

Exactly.  I think we're in violent agreement on this issue ;-)



More information about the Python-list mailing list