[C++-sig] boost python and keyword aguments
Moe Goldberg
goldberg at coredp.com
Thu May 8 20:44:41 CEST 2008
If I'm writing pure python, I can do the following:
def pyfunc(**kwargs):
print kwargs
then call it as follows:
>>> pyfunc()
{}
>>> pyfunc(a="b", c="d", arbitrary_key="value")
{'a': 'b', 'c': 'd', arbitrary_key: 'value'}
Is there a way with boost python to do the same thing? i.e. write a
function in C++ something like:
void cppfunc(boost::python::dict kwargs)
{
// ... do something ...
}
That can be called in python like this:
>>> cppfunc(a="b", c="d", arbitrary_key="value")
The important thinhg is that I be able to call it with keyword args, and
not by passing a dict
Thanks
More information about the Cplusplus-sig
mailing list