[C++-sig] Call Python functions generically

William Marié william.marie at gmail.com
Thu Sep 11 09:39:31 CEST 2008


Hi,

I would like to know if there is an easy way to create generic python
function calls using a tuple or something like that.

ex : 

void call( const char* szFunName, bp::tuple bpTuple )
{
      // Something like that
      bp::call( szFunName, bpTuple );
}

bpTuple being the args list...

In Python to do that we can use something like that :
arglist = Py_BuildValue("(i)", arg);
result = PyEval_CallObject(my_callback, arglist);

but i don't if a similar mechanism exists in boost python.

Thanks for your help

William
-- 
View this message in context: http://www.nabble.com/Call-Python-functions-generically-tp19429482p19429482.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.




More information about the Cplusplus-sig mailing list