C API - Creating Python Classes

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


Hi,

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
done?

I assume I need something like:

	PyObject *pModule = PyImport_ImportModule( "MyClassScript" );

	PyObject *pInstance = NEW_INSTANCE( pModule, args );


thanks for any help,

mark.




More information about the Python-list mailing list