__cmp__ between dissimilar objects

insyte at gmail.com insyte at gmail.com
Tue Nov 14 17:27:58 EST 2006


> >Can you point me to a description of this algorithm?  It doesn't seem
> >to be described in the documentation for the rich comparison or __cmp__
> >methods...
>
> PEP 207
> http://www.python.org/dev/peps/pep-0207/

So since I implemented __cmp__ instead of the rich comparison
operators, Python first tried to reverse the comparison.  This gave
datetime the opportunity to throw TypeError *before* the interpreter
failed over to trying __cmp__.

Is that correct?

Thanks!

-Ben




More information about the Python-list mailing list