comparing str's with ints
Andrew Dalke
dalke at dalkescientific.com
Mon Apr 29 18:35:20 EDT 2002
Kragen:
>Thus, heterogeneous collections are sortable. This might be a wart;
>once, couldn't raise exceptions, and now we're stuck with its old
>behavior in this case for compatibility. It's kind of nice that
>heterogeneous collections are sortable, though.
Nice perhaps, but not true.
>>> a = [1, 1j]
>>> a.sort()
Traceback (most recent call last):
File "<stdin>", line 1, in ?
TypeError: cannot compare complex numbers using <, <=, >, >=
>>>
Andrew
dalke at dalkescientific.com
More information about the Python-list
mailing list