[Python-Dev] NotImplemented comparisons

Georg Brandl g.brandl at gmx.net
Thu Aug 2 22:06:14 CEST 2007


Guido van Rossum schrieb:
> NonImplemented isn't treated as special when returned by __cmp__();
> __cmp__ is not considered a binary operator like __add__. (__lt__ and
> friends *do* get treated as such -- but instead of __rlt__ we use
> __gt__, etc.)

But if it's not treated as special, why doesn't the comparison raise an
exception, like when __cmp__ returns "foo", for example?

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.



More information about the Python-Dev mailing list