[Python-Dev] cmp(x,x) (original) (raw)

Andrew Koenig ark-mlist at att.net
Tue May 25 12:07:09 EDT 2004


IOW, we're still looking for a use case that warrants removing the identity-implies-equality guarantee out of PyRichCompareBool().

I can think of two use cases:

1) IEEE-like behavior.  Before you say that there is nothing wrong

with making floating-point comparison yield true for NaN==NaN, let me remind you of the beast called "Signaling NaN", which should raise an exception on any operation, including comparison.

2) A class might have comparison operations that put trace

information in a log file for testing purposes. Such a class might be intended to help in testing searching algorithms, for example. I think it would be useful to be able to know whether x[i] is ever compared with x[i] by putting appropriate tracing comparison operations in the elements of x.



More information about the Python-Dev mailing list