Accessing a PyInstances dictionary from C++
Simon Burton
simonb at webone.com.au
Fri Jan 3 03:21:04 EST 2003
On Fri, 03 Jan 2003 20:27:05 +1300, Lloyd wrote:
> Hey
>
> I'm trying to call a method on a python object from C++. I have a PyInstance
> but can't for figure out how to obtain the dictionary from the instance so
> that I can call the method on the object.
>
> Any help appreciated.
>
> Thanks
PyObject_CallMethod(instance, method_name, format, ... )
there are a few other functions to check out,
and the dictionary could be obtained using PyObject_GetAttr,
and '__dict__'.
Remember: all these Py* pointer things are also PyObject pointers.
eg. a PyInstanceObject is also (can be used as) a PyObject.
bye,
Simon Burton
More information about the Python-list
mailing list