Embedding Python - How to create a class instance

Miki Tebeka miki.tebeka at zoran.com
Mon Jun 20 07:38:17 EDT 2005


Hello Denis,

>> I'm trying to embed Python in a C application.
>> What I didn't find is how to create an instance once I have a class object.
> 
> Class is a callable object.  Just call it to create instance.
> ... 
> obj = PyObject_CallObject(A, NULL);
Thanks.

After grepping the Python sources I've found about 
    obj = PyInstance_New(A, NULL, NULL)
which worked for me.

Bye.
--
------------------------------------------------------------------------
Miki Tebeka <miki.tebeka at zoran.com>
http://tebeka.bizhat.com
The only difference between children and adults is the price of the toys
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 193 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/python-list/attachments/20050620/f151db19/attachment.sig>


More information about the Python-list mailing list