Would there be support for a more general cmp/__cmp__
apardon at forel.vub.ac.be
Fri Oct 21 08:53:20 CEST 2005
Op 2005-10-20, Steve Holden schreef <steve at holdenweb.com>:
> Antoon Pardon wrote:
> Ergo: use rich comparisons.
rich comparosons can only solve the problem partly.
Python does have the cmp function and that can give
totaly inconsistent results even when the order
defined by the rich comparison functions is consistent
but only partial.
I think it is a problem if cmp gives me the following
>>> a1 = foo(1)
>>> a2 = foo(2)
>>> b1 = foo(1)
>>> b2 = foo(2)
It would be better if cmp would give an indication it
can't compare two objects instead of giving incorrect
and inconsistent results.
More information about the Python-list