[docs] [issue29986] Documentation recommends raising TypeError from tp_richcompare

Jeroen Demeyer report at bugs.python.org
Wed Mar 27 02:35:00 EDT 2019


Jeroen Demeyer <J.Demeyer at UGent.be> added the comment:

The consensus is clearly to return NotImplemented in this case, also because that's what most builtins do, like the object() example that you mentioned.

However, I would rather keep that note and change it to say return NotImplemented. It's an important difference between tp_richcompare and the 6 Python methods __eq__ and friends. Explicitly saying what do you if you only want __eq__ and __ne__ but no other operators (which is not exceptional at all) looks useful to me.

----------
nosy: +jdemeyer

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue29986>
_______________________________________


More information about the docs mailing list