[Python-Dev] NotImplemented comparisons

Facundo Batista facundobatista at gmail.com
Thu Aug 2 22:17:18 CEST 2007


2007/8/2, Paul Moore <p.f.moore at gmail.com>:

> A wild guess: c < None falls back to checking c.__cmp__(None) < 0.
> This translates to NotImplemented < 0, and as the ordering of built in
> types is implementation dependent, maybe that explains the difference
> between Windows and Linux?

"NotImplemented < 0" returns False, which is ok, but different from "c < None"


2007/8/2, Guido van Rossum <guido at python.org>:

> > But how do you explain the difference in behaviour between Linux and Windows?
>
> Perhaps the comparison compares the objects' address.

No, because NotImplemented and None are always the same: if this is
the problem Linux and Windows could be different but they would be
consistent with themselves (and Windows is not coherent with itself).


Bottom line: I can easily fix Decimal to handle this special case, the
point is that maybe we have a lower level bug here...

Regards,

-- 
.    Facundo

Blog: http://www.taniquetil.com.ar/plog/
PyAr: http://www.python.org/ar/


More information about the Python-Dev mailing list