On Mon, Jan 25, 2010 at 6:59 AM, Lennart Regebro <lrege...@jarn.com> wrote:
[snip]
> If class A returns NotImplemented when compared to class B, and class
> B implements the recipe above, then we get infinite recursion, because
>
> 1. A() < B() will call A.__lt__(B) which will return NotImplemented.
> 2. which will mean that Python calls B.__ge__(A)
> 3. Which B implements by doing A < B
> 4. Start over at 1.

A small correction;  For the purposes of NotImplemented the opposite
of __lt__ is __gt__ because if A < B then B > A.  The pairs are ('==',
'!='), ('<', '>'), ('<=', '>=').

-Jack
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to