Thx, but my Problem is to get my own type before. If I have a C-Type, I know how tu return it from the Python extention, but how will it work with my own type? I expect something like the following:
static PyObject* wrap_MyFunction (PyObject* self, PyObject* args) { : MyPyType *myType = MyTypeNew (); return (PyObject*)myType; } How will the Konstructor-Funktion look for MyPyType to call this in C-Code. ...If I explain my problem to confuesed here more informations: I have one function for MyPyType to construct it by calling from python: static PyObject* PyMyType_new(PyTypeObject *type, PyObject *args, PyObject *kwds) { PyMyType *self; self = (PyMyType*)type->tp_alloc(type, 0); if (self != NULL) { self->test = 0; } return (PyObject *)self; } ..but how do I have to call this from C-Code or how will another Funktion for this look like? Jeremy Moles wrote: > You can use Py_BuildValue for most what you're probably going to need. > > http://docs.python.org/api/arg-parsing.html > > On Thu, 2005-09-29 at 15:39 +0200, elho wrote: > >>I used the examples from the "Extending and Embedding the Python >>Interpreter" tutorial and this works. I can use my types with python. >>But I do not know how to creat my own Python variable in an python >>extending c-code. What will I have to creat this and return it to my >>python programm? > > -- http://mail.python.org/mailman/listinfo/python-list