C API - Creating Python Classes

Mark Pope M_Pope at shef.rage.co.uk
Wed Apr 26 05:41:56 EDT 2000


Using the python C API I can, for example, create an Integer Python object
with the call:

	PyObject *pMyInt = PyInt_FromLong( 123 );

I have a python class which I need to create an instance of. How is this

I assume I need something like:

	PyObject *pModule = PyImport_ImportModule( "MyClassScript" );

	PyObject *pInstance = NEW_INSTANCE( pModule, args );

thanks for any help,


More information about the Python-list mailing list