Python/C API

Joerg Baumann joerg.baumann at stud.informatik.uni-erlangen.de
Thu Oct 5 04:42:09 EDT 2000


Hi,

I´m trying to extend python and I have following problem with the C/API:

Howto make a new instance of a class defined in Python from C?

If I have
<pre>
class foo:
    def __init__(self,data):
        ....
</pre>

how to write
<pre>
f=foo("blabla)
</pre>
in C?

I´m searching for somthing like

PyObject*
f=PyInstace_New(PyString_FromString("foo"),PyString_FromString("data"))

Can anybody help me?

Regards
   joerg




More information about the Python-list mailing list