[Python-Dev] redefining is

Jewett, Jim J jim.jewett at eds.com
Fri Mar 19 13:42:16 EST 2004


Robert Brewer:

>    Value equality: x == y

>    Object equivalence: x equiv y		
>                    or: equiv(x, y)

>    Object identity: x is y
>                 or: id(x) == id(y)

> Now if we can only find a short English word that means 
> "mutually substitutable". ;)

So identity means the same object, and implies equivalence.

Equivalence means they will always have the same value, even
if you do something to one and not the other.  This implies
(current value) equality.

equality just means that they have the same value *now*.

Since equivalence is a stronger form of equality, why not
just use "===".  

Anything that is === will also be ==, but the extra character
will mark it as special.  If the mark isn't strong enough,
perhaps "=~="; in math the ~ often modifies equality to mean
"not identical, but close enough".

equal_forever would also work, and be explicit.  equal_forever
has the additional advantage that it could be written as a 
function rather than an operator during a trial period.

-jJ



More information about the Python-Dev mailing list