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

Devin Jeanpierre report at bugs.python.org
Tue Apr 4 19:01:22 EDT 2017


Devin Jeanpierre added the comment:

Sorry, forgot to link to docs because I was copy-pasting from the PR:

https://docs.python.org/2/c-api/typeobj.html#c.PyTypeObject.tp_richcompare

https://docs.python.org/3/c-api/typeobj.html#c.PyTypeObject.tp_richcompare

> Note: If you want to implement a type for which only a limited set of comparisons makes sense (e.g. == and !=, but not < and friends), directly raise TypeError in the rich comparison function.

----------

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


More information about the docs mailing list