Magic methods in extension types

Jacek Generowicz jacek.generowicz at cern.ch
Mon Apr 26 07:04:06 EDT 2004


I am writing an extension type, and wish to add some magic methods
which are not catered for by the tp_<whatever> slots (eg tp_init ->
__init__) in PyTypeObject. My methods seem to work correctly when
invoked explicitly (eg obj.__iadd__(3)) but the method seems not to be
associated with the corresponding operator (ie obj += 3 does NOT
work).

What am I likely to be doing wrong ?



More information about the Python-list mailing list