Incomparable abominations (was: python-dev Summary)

David Eppstein eppstein at ics.uci.edu
Thu Mar 20 10:21:40 EST 2003


In article <x78yvanmc7.fsf at guru.mired.org>, Mike Meyer <mwm at mired.org> 
wrote:

> I claim I should get an error when I compare incomparable types,
> because explicit beats implicit, and the current behavior has no
> practical value.

Sure it does, it has the value that (if L is a list) L.sort() always 
puts it in a canonical ordering (same list produces the same ordering, 
within runs from the same version of Python) so e.g. you can compare 
sets of items for equality without worrying about them being in 
different orders.  That is, it works if you're not so foolish as to put 
complex numbers into your sets...

-- 
David Eppstein                      http://www.ics.uci.edu/~eppstein/
Univ. of California, Irvine, School of Information & Computer Science




More information about the Python-list mailing list