Performance of list vs. set equality operations
Gabriel Genellina
gagsl-py2 at yahoo.com.ar
Fri Apr 9 14:07:33 EDT 2010
En Thu, 08 Apr 2010 21:02:23 -0300, Patrick Maupin <pmaupin 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
More information about the Python-list
mailing list