Why keep identity-based equality comparison?

Antoon Pardon apardon at forel.vub.ac.be
Wed Jan 11 03:10:11 EST 2006


Op 2006-01-10, Christopher Subich schreef <csubich.spam.block at spam.subich.block.com>:
> Antoon Pardon wrote:
>> Op 2006-01-10, Peter Decker schreef <pydecker at gmail.com>:
>
>>>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))
>> does.
>
> Breaking my resolution already, but you're ignoring the fact that the 
> set type uses the '<' and '>' operators from a set-theoretic, not 
> number-theoretic point of view.

That is irrelevant. the '<' and '>' symbols are usable to denote any
mathematical order and are often enough used for even other order
relations. The only reason that other symbols like the subset symbol
are used is to avoid confusion about which order you are talking
because numbers and sets are used together often enough.

But the superset relationship is mathematically just as much an
order relation as is the greater than relationship.

> Saying "set(1,3) is greater than 
> set(1,2)" is meaningless (and not false), because the mathematical basis 
> of the operator in this context is superset -- "set(1,3) is a superset 
> of set(1,2)" is well-defined and false.

No it is not meaningless. The superset relationship is just as much
an order relationship and thus can mathematically make use of the
'<' and '>' symbol just as any mathematical order relation can.

-- 
Antoon Pardon



More information about the Python-list mailing list