comparing str's with ints

Andrew Dalke dalke at dalkescientific.com
Wed May 1 21:39:33 EDT 2002


Kragen:
I guess heterogeneous collections are no
>longer sortable.  I guess that means complex numbers were added after
>== and > could raise exceptions.

Complex numbers were added a long time ago -- I think in '94 or
'95 (it was just when I was starting Python).  They didn't raise
exceptions until Python 2.1 alpha 1.  Here's the change info

] - Complex numbers use rich comparisons to define == and != but raise
]   an exception for <, <=, > and >=.  Unfortunately, this also means
]   that cmp() of two complex numbers raises an exception when the two
]   numbers differ.  Since it is not mathematically meaningful to compare
]   complex numbers except for equality, I hope that this doesn't break
]   too much code.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list