Steven D'Aprano writes:
I don't know what Guido means by "values might not be comparable",
Guido evidently meant something more pragmatic, but as I see it, values of different types are in principle incomparable, and the odict == dict == odict example shows why: satisfying the equality definitions of different types simultaneously is often impossible. But if you transform them to a common type or unify them in a union type, I think it's reasonable to expect that the common type will implement equality as an equivalence relation. (As you indirectly mentioned yourself, that's why we accept objects like NaN only as a last resort in preserving compatibility with a truly important standard we can't change.) In Python, the TOOWTDI common type for fallback is object, and that works well enough as a default implementation of __eq__ (ie, "is") that allows for equality comparison across types, which can be useful.
but your example is lack of transitivity.
Mathematical equality is transitive: if a == b, and b == c, then a == c. But that doesn't extend to non-numeric concepts of equality, e.g. preference ordering, or other forms of ranking.
Indifference (the notion of "equality" that applies to preference, at least in economics) in practice is always an equivalence; all use cases I know of require this (many strengthen it to actual equality, ie, requiring antisymmetry). I can't think of a case where I would consider any equality relation deliberately defined as not an equivalence to be anything but perverse. So I'm not sure what you're trying to say here. I guess you mean that as a pragmatic matter, a programming language may allow perverse definitions, and of course there may be artifacts of particular definitions such that objects of types that should always be considered unequal might compare equal. I suppose there are "consenting adults" cases where it's convenient for a particular use case to use a perverse definition. And yes, I consider "fall back to the less restrictive definition of equality", as done by OrderedDict and dict in the example, to be perverse.