Python 2.x breaks cmp() (was Re: A suspected bug)

Aahz Maruch aahz at panix.com
Sun Feb 18 11:11:49 EST 2001


In article <slrn98vrqv.i0.amk at mira.erols.com>,
A.M. Kuchling <akuchlin at mems-exchange.org> wrote:
>On Sun, 18 Feb 2001 11:12:57 GMT, Fredrik Lundh <fredrik at pythonware.com> wrote:
>
>>except that it doesn't always work:
>
>And as Andrew Dalke pointed out:
>>>> L=[1j, 2j]
>>>> L.sort()
>Traceback (most recent call last):
>  File "<stdin>", line 1, in ?
>TypeError: cannot compare complex numbers using <, <=, >, >=
>>>>

Is there any chance this can be treated as a bug and fixed for the
release of 2.1?  Alternatively, given that we're already breaking code
with the change in the way complex numbers are handled, should cmp() now
raise an exception *every* time the type/class differs?

I think the current situation is going to cause major problems trying to
explain Python, particularly on the Unicode side.
-- 
                      --- Aahz (Copyright 2001 by aahz at pobox.com)

Androgynous poly kinky vanilla queer het    <*>     http://www.rahul.net/aahz/
Hugs and backrubs -- I break Rule 6

Why doesn't "Just Say NO" include caffeine, nicotine, alcohol, Prozac,
and Ritalin?  --Aahz



More information about the Python-list mailing list