[Python-ideas] Automatic comparisons by default
Greg Ewing
greg.ewing at canterbury.ac.nz
Wed Mar 16 23:53:32 CET 2011
Steven D'Aprano wrote:
> Greg Ewing wrote:
>
>> 1) __cmp__ returns one of four possible results: LessThan,
>> EqualTo, GreaterThan or NotEqual (the latter for unordered
>> types).
>
> Wouldn't that last one be better called Unordered rather than NotEqual?
No, I don't think so. To me, "unordered" is an adjective that
applies to a class of objects, not to individual objects.
If you ask whether two particular objects of an unordered
class are equal, the possible answers are "yes, they're equal"
or "no, they're not equal". And either way, they're still
"unordered".
> And shouldn't there be provision for __cmp__ to return NotImplemented,
Yes, as always.
--
Greg
More information about the Python-ideas
mailing list