[Python-Dev] cmp(x,x)

Armin Rigo arigo at tunes.org
Fri May 21 11:23:49 EDT 2004


Hello Michael,

On Fri, May 21, 2004 at 08:07:53AM -0700, Michael Chermside wrote:
> Performance is certainly a legitimate concern.

Ok, then the current situation looks like the best one.  I suggest we just
drop a note in the documentation saying that if there are objects for which
x.__eq__(x) isn't necessarily true, you shouldn't expect them to be handled in
a fully consistent way.

> But wouldn't your
> performance problems be fixed just as well if the tuple class implemented
> "identical-objects-are-immediately-equal" instead of putting it in the
> general comparison logic for all objects? Because if I understand
> correctly, that's what Armin is suggesting. Tuples would still be
> compared just as rapidly.

There is an extra costly indirection until the execution reaches that point.


Armin



More information about the Python-Dev mailing list