Why keep identity-based equality comparison?

Antoon Pardon apardon at forel.vub.ac.be
Tue Jan 10 09:05:40 EST 2006

Op 2006-01-10, Peter Decker schreef <pydecker at gmail.com>:
> On 10 Jan 2006 13:33:20 GMT, Antoon Pardon <apardon at forel.vub.ac.be> wrote:
>> IMO if they aren't of the same type then the answer to:
>>   a < b
>> is just as obviously False as
>>   a == b
>> Yet how things are proposed now, the first will throw an exception
>> and the latter will return False.
> I don't see the two comparisons as equivalent at all. If two things
> are different, it does not follow that they can be ranked.

That a < b returns false doesn't imply that a and b can be ranked.
take sets. set([1,2]) and set([1,3)) can't be ranked but 
set([1,2]) < set([1,3)) returns False just as set([1,2]) > set([1,3))

> If we have
> two objects, such as a spark plug and a cam shaft, it is one thing to
> say that the two are not the same object; it is quite another to say
> that one is 'greater than' or 'less than' the other.

But we don't say the latter. What we do say is that one is 'not greater
than' and 'not lesser than' (and 'not equal to') the other.

Antoon Pardon

More information about the Python-list mailing list