Is 0 > None?? (fwd) (fwd)
Marcin 'Qrczak' Kowalczyk
qrczak at knm.org.pl
Tue Sep 4 21:55:08 CEST 2001
4 Sep 2001 17:56:50 GMT, Paul Svensson <paul at svensson.org> pisze:
> But, since we're working from the presumption that heterogenous
> comparisons are NOT a strict superset of homogenous comparisons
> (or we could use heterogenous comparisons all the time and not have
> this discussion), there will be cases where heterogenous X<Y and
> homogenous X>Y.
In my model there are no such cases, but there are cases where
heterogenous X<Y is true, and homogenous X<Y is undefined (raises
If it follows that we should use heterogenous comparison all the
time, then I'll respond: why complex numbers are unordered now?
Probably because we didn't want to introduce a comparison with an
arbitrary result, which doesn't follow in a natural way from the
domain. We shouldn't pretend that there is a natural order among
But we already do have arbitrary results when domains are different.
It's because comparisons are used not only for meaningful answers like
"which is larger" or "does this contain that" (the latter doesn't
have to have the property that forall X Y. X<=Y or X>=Y) but also for
introducing any order for speeding up computations. E.g. for comparing
sets by comparing sorted lists of their elements: it doesn't matter
what does it mean that 'a'>4, or even whether 3<4 or vice versa,
only that the order will be the same in both sets, so we can then
perform a linear scan instead of comparing each element of the first
set with each of the second.
So maybe it would be good to separate these issues. It would allow
to have cases similar to complex numbers among user defined types
without disadvantages of not having a total order. It would open the
door for <= on sets meaning being a subset, even though some sets
may be unordered (i.e. X<=Y and X>=Y both defined but both false)
- it doesn't matter that it's not consistent with cmp because it's
used for different purposes.
__("< Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
^^ SYGNATURA ZASTĘPCZA
More information about the Python-list