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

Marcin 'Qrczak' Kowalczyk qrczak at knm.org.pl
Tue Sep 4 12:48:02 EDT 2001


4 Sep 2001 16:22:51 GMT, Paul Svensson <paul at svensson.org> pisze:

>>c. Have two kinds of comparison, homogeneous and heterogeneous.
>>This solves the complex numbers problem, but unfortunately not the
>>str <-> unicode problem.
> 
> Actually, it does, if you just don't insist on converting things.
> Of course, this would have some not-quite-intuitive consequences,
> like 'A' != u'A' or 1 != 1+0j.

It doesn't imply 1 != 1+0j, because the order between differently
represented numbers is consistent if currently defined. Among numbers
it would behave as currently for homogeneous comparisons, and as it
used to for heterogeneous ones (complex numbers would be treated as
if they had a lexicographic ordering, e.g. cmp(2, 3+10j) == -1,
cmp (3+10j, 4) == -1; but 2 < 3+10j < 4 is undefined).

< would be less often defined than currently ('a' < 3 is undefined),
cmp would be more often defined (cmp(1, 1j) == 1).

It does imply 'A' != u'A' unless we convert using ASCII or Latin1
for the purposes of comparison, but it would be bad (ASCII comparison
succeeds only sometimes, Latin1 comparison is wrong wrt. real meaning
of these strings).

-- 
 __("<  Marcin Kowalczyk * qrczak at knm.org.pl http://qrczak.ids.net.pl/
 \__/
  ^^                      SYGNATURA ZASTĘPCZA
QRCZAK



More information about the Python-list mailing list