[Python-Dev] redefining is
Andrew Koenig
ark-mlist at att.net
Fri Mar 19 16:50:01 EST 2004
> So identity means the same object, and implies equivalence.
Yes.
> 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.
Yes, unless equality is defined weirdly. For example, IEEE floating-point
NaN is supposed to be unequal to itself.
> equality just means that they have the same value *now*.
I'm not sure the implication goes the other way. Consider a string-like
type for which == ignores case. Then equivalence implies identity, but not
the other way.
> Since equivalence is a stronger form of equality, why not
> just use "===".
Seems plausible.
> 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".
I wish. But unfortunately sometimes x == x is False.
> 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.
Indeed. I'd prefer something shorter, though, such as equiv.
More information about the Python-Dev
mailing list