No right operator in tp_as_number?
MRAB
python at mrabarnett.plus.com
Sat Nov 20 13:35:20 EST 2021
On 2021-11-20 17:45, Marco Sulla wrote:
> I checked the documentation:
> https://docs.python.org/3/c-api/typeobj.html#number-structs
> and it seems that, in the Python C API, the right operators do not exist.
> For example, there is nb_add, that in Python is __add__, but there's
> no nb_right_add, that in Python is __radd__
>
> Am I missing something?
>
A quick Google came up with this:
Python's __radd__ doesn't work for C-defined types
https://stackoverflow.com/questions/18794169/pythons-radd-doesnt-work-for-c-defined-types
It's about Python 2.7, but the principle is the same.
More information about the Python-list
mailing list