Antoon Pardon wrote: > Christopher Subich schreef : > >> Antoon Pardon wrote: >>> >>>from decimal import Decimal >>> >>>Zero = Decimal(0) >>> >>>cmp( ( ) , Zero) >>> -1 >>> >>>cmp(Zero, 1) >>> -1 >>> >>>cmp(1, ( ) ) >>> -1 >> >> I'd argue that the wart here is that cmp doesn't throw an exception, not >> that it returns inconsistent results. This is a classic case of >> incomparable objects, and saying that 1 < an empty tuple is bordering on >> meaningless. > > I wont argue with you here, but it is what python gives as now. > Changing this behaviour is not going to happen.
FWIW, Guido has said a few times that in Python 3.0 we should "Raise an exception when making comparisons (other than equality and inequality) between two incongruent types."[1] But yes, the behavior won't change in the Python 2.X series due to backwards compatibility concerns. STeVe [1] http://wiki.python.org/moin/Python3%2e0 -- http://mail.python.org/mailman/listinfo/python-list