Are there any list comparison optimizations in Python?

Skip Montanaro skip at
Fri Nov 16 17:22:16 CET 2001

    Steve> Skip, I think you just turned this discussion on its head. The
    Steve> question you responded to was not "should equal values compare
    Steve> true with 'is'", but "is it useful for 'a != b' and 'a is b' to
    Steve> be true for the same a and b".

Have you considered that maybe the discussion was standing on its head
before and I simply righted it? ;-)

I was trying to answer the quesion "should equal values compare true with
'is'" with "no, and here's why."  The expense of keeping immutable objects
interned so you can do simple pointer comparisons for them and the mutable
object issue both argue that they shouldn't.


More information about the Python-list mailing list