# Is 0 > None?? (fwd) (fwd)

Paul Svensson paul at svensson.org
Tue Sep 4 19:56:50 CEST 2001

```"Alex Martelli" <aleax at aleax.it> writes:

>"Marcin 'Qrczak' Kowalczyk" <qrczak at knm.org.pl> wrote in message
>news:slrn9p9gsh.415.qrczak at qrnik.zagroda...
>> Tue, 4 Sep 2001 10:01:02 +0200, Alex Martelli <aleax at aleax.it> pisze:
>>
>> > Comparison issues, and sorting of heterogeneous lists in
>> > particular, ARE central to the new noncomparable behavior
>> > of complex numbers.  I see no solution to THAT one, save:
>> >     a. either drop the pretense that it makes sense to
>> >         compare heterogeneous entities, or
>> >     b. regress the change that makes it illegal to compare
>> >         complex numbers.
>>
>> c. Have two kinds of comparison, homogeneous and heterogeneous.
>> This solves the complex numbers problem, but unfortunately not the
>> str <-> unicode problem.
>
>It 'solves' the problem of sorting a list that has ONE complex
>number among a zillion other items, but as soon as you have
>TWO complex numbers (no matter whether there's a zillion others)
>you're hosed again.  Seems a half-solution to me:-).

You're assuming that the choice between heterogenous/homogenous
comparison should be made from time to time, based only on the
two objects being compared.  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.  Thus, mixing heterogenous
and homogenous comparisons in the same sort may break some of
the assumptions made by the sorting algorithm, and produce
unpredictable results.

Just take one more step: once you've decided that you're sorting
a heterogenous list, use the heterogenous comparisons thru it all.

/Paul

```