C extension objects: possible to obtain __rmul__ functionality?

Bernt Ribbum bernt at tordivel.no
Wed Mar 26 15:29:11 CET 2003

I wonder if this is at all possible:

In a C extension module it is quite easy to create objects that can appear
on the left side of e.g. a multiplication, as in

CObject * PythonObject

I find no way to make the object appear on the right side (PythonObject *
CObject), except by overloading the __mul__ function in a Python class (of
which PythonObject would be an instance in the example above). I would love
to have this handled by a __rmul__ equivalent in my C class.

Have anyone done this?

Thanks in advance,


- Bernt
TORDIVEL AS  http://www.tordivel.no
Storgata 20  0184 OSLO  NORWAY
Tel +47 2315 8700  Fax +47 2315 8701
Bernt Ribbum  bernt at tordivel.no  bernt.ribbum at ieee.org
Direct: +47 2315 8714  Mobile: +47 906 106 85

More information about the Python-list mailing list