Op 2005-10-20, Steve Holden schreef <[EMAIL PROTECTED]>: > 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 results. >>> a1 = foo(1) >>> a2 = foo(2) >>> b1 = foo(1) >>> b2 = foo(2) >>> cmp(a1,b1) 0 >>> cmp(a2,b2) 0 >>> cmp(a1,a2) 1 >>> cmp(b1,a2) 1 >>> cmp(a1,b2) -1 It would be better if cmp would give an indication it can't compare two objects instead of giving incorrect and inconsistent results. -- Antoon Pardon -- http://mail.python.org/mailman/listinfo/python-list