Steven D'Aprano wrote:
> Python already allows you to compare "this is not a number" with the float
> 5.0. Mathematically, that is meaningless, but I would bet money that
> 99.9% of programmers would demand that they should be able to sort the
> list ["this is not a number", 5.0]. Do you think that it is unintuitive
> too?

I strongly suspect that 99.8% of (let's say non-newbie) programmers 
would have no expectation that the default sort routine would do 
something other than barf on that input.  You want "garbage in, garbage 
out", but in Python it's supposed to be "garbage in, exception out, 
please be explicit about what you want next time".

I can't think of any use case for sorting a list like that which 
wouldn't most appropriately be handled with a custom comparison routine 
passed to sort.

-Peter
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to