On 22 Nov, 04:05, Carl Banks <pavlovevide...@gmail.com> wrote: > name = PyString_FromString("vanilla"); > bases = PyTuple_New(0); > dict = PyDict_New(); > vanilla_type = PyObject_CallObject( > &PyType_Type,name,bases,dict,0); > > Then call the vanilla type (however you create it) to get a vanilla > object: > > vanilla_object = PyObject_CallObject(vanilla_type,0); > > Definitely not the most straightforward thing to do from C.
It is much easier to do this from Cython. cdef class foo: # fields stored in C struct pass class foo: # fields stored in Python dict pass The let the Cython compiler generate the C code you need. http://docs.cython.org/src/tutorial/cdef_classes.html -- http://mail.python.org/mailman/listinfo/python-list