Registering a python function in C

Hrvoje Niksic hniksic at
Fri Aug 31 13:06:00 CEST 2007

fernando <fernandofariajunior at> writes:

> Could someone post an example on how to register a python function as
> a callback in a C function?

If I understand correctly, your C function receives a Python function
(as a function object of type PyObject *), which you need to call from
C.  To do that, call PyObject_CallFunction(obj, format, args...) where
format and args are documented in

Does that help?

Also note that there is a dedicated mailing list for the Python/C
API; see .

More information about the Python-list mailing list