Lennart Regebro <rege...@gmail.com> added the comment:

Ah! I see how you mean. The problem isn't just if you turn the conversion 
around from self > other to other < self. The problem in fact appears when a 
rich text function uses the <>!= operators on self directly.

I tried a version which uses the __xx__ operators directly and that works for 
the ones that does not use "not". "not NotImplemented" is false, for obvious 
reasons, and that means that with for example "lambda self, other: not 
self.__ge__(other)" will return False, when it should return NotImplemented.

In effect this means that the total ordering recipe only works as long as you 
don't compare two classes that use the total ordering recipe. :-)

I don't think the lambda technique is going to work properly. Of course we can 
say that we should care about NotImplemented, but then first of all this recipe 
needs a big "this is broken, don't use it unless you know what you are doing" 
label, and secondly I don't think it should have been included in the first 
place if we can't make it work properly.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<http://bugs.python.org/issue10042>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to