M.-A. Lemburg <mal <at> egenix.com> writes:
> 
> >>> None > None
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> TypeError: unorderable types: NoneType() > NoneType()
> >>> None != None
> False
> 
> Two values that compare equal to each other (and are in fact identical),
> yet cannot be compared less-than or greater-than.

The error message is clear: "unorderable types". Having some types support an
equivalence relation (e.g. "equality") but no intuitive total order relation is
hardly a surprise. As someone said, complex numbers are an example of that (not
only in Python, but in real life).

> This would make sense if you think of None as meaning "anything
> and/or nothing", since the left side None could stand for
> a different None than the right one, but then you could apply the
> same logic to inf:

inf is a float instance, and as such supports ordering. I don't see how it
invalidates None *not* supporting an order relation, since None isn't a float
instance and doesn't pretend to be usable as a number (or as anything supporting
ordering, for that matter).



_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to