Create a instance of Python Class in C++?

Gerhard Häring gerhard.haering at
Thu Aug 22 19:53:16 CEST 2002

Arivazhagan wrote in comp.lang.python:
> Hi 
> Do any one know how to use a class defined in python in C++? Is it
> possible?

Call it with PyObject_CallObject. Get access to the class using
PyObject_GetAttr, once you have its module object.
mail:   gerhard <at> bigfoot <dot> de       registered Linux user #64239
web:    OpenPGP public key id AD24C930
public key fingerprint: 3FCC 8700 3012 0A9E B0C9  3667 814B 9CAA AD24 C930
reduce(lambda x,y:x+y,map(lambda x:chr(ord(x)^42),tuple('zS^BED\nX_FOY\x0b')))

More information about the Python-list mailing list