Interesting behaviour of the assignment

Aahz Maruch aahz at
Fri Dec 29 18:42:14 EST 2000

In article <92j4n1$mhu$0 at>,
Michael Esveldt  <dante at> wrote:
>[Thomas Wouters]
>> In other words, 'x == y' first does 'x is y', and if it's true, the
>> result of the operation is true. Only if 'x is y' is false will it
>> start the (possibly very expensive) comparison-by-contents operation.
>This is a somewhat ignorant question, but if 'x == y' checks for 'x is
>y' first, why use 'is' at all? If you only get a tiny bit of speed out
>of using 'is' is it worth it to have this in the language at all? (Not
>that it would ever change, just curious.)

Because sometimes you really do want to know if two objects are the same
(rather than simply being equal).  If you drop "is", you can't check for
object identity.
                      --- Aahz (Copyright 2000 by aahz at

Androgynous poly kinky vanilla queer het    <*>
Hugs and backrubs -- I break Rule 6

Ninth Virtual Anniversary: 2 days and counting

More information about the Python-list mailing list