> Can anybody tell me how to call "f" in my C code?

Assuming you already have a handle to an instance of MyClass this should 
do the trick:

PyObject *func = PyObject_GetAttrString(MyClassInst,"f");
if(func) {
     PyObject *result = PyObject_CallObject(func,NULL);
     if(result) {
         //Do something with result
         Py_DECREF(result);
     }
     Py_DECREF(func);
}

Have a look in the "Python/C API Reference Manual" for more information.

-Farshid
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to