On 23/09/20 12:20 am, Steven D'Aprano wrote:
Presumably back when rich comparisons were added, the choice would have
been:

- add one tp_richcompare slot to support all six methods; or

- add six slots, one for each individual dunder

in which case the first option wastes much less space.

I don't know the exact reasons, but it might also have been
because the implementations of the six dunders are usually
very closely related, so having just one function to implement
at the C level is a lot easier for most types.

Also remember that before tp_richcompare existed there was
only tp_compare, which also handled all the comparisons, so
tp_richcompare was likely seen as a generalisation of that.

--
Greg
_______________________________________________
Python-Dev mailing list -- python-dev@python.org
To unsubscribe send an email to python-dev-le...@python.org
https://mail.python.org/mailman3/lists/python-dev.python.org/
Message archived at 
https://mail.python.org/archives/list/python-dev@python.org/message/SD2YPQSBV3MQ3GGNHVGRM3QM7WEBCTKG/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to