[C++-sig] boost python and keyword aguments
Nikolay Mladenov
nickm at sitius.com
Tue May 13 21:30:26 CEST 2008
Moe Goldberg wrote:
> Is there a way to write a C++ function with set args, but still use
> kwargs ... such as:
> myfunc(arg1, arg2, arg3, **kwargs):
> do_something()
>
I have not used raw_function much, but it seems to me that if you have:
result_t myfunc( Type1 arg1, Type1 arg2, tuple posargs, dict kwargs)
{
do_something();
}
you will have to wrap it first with:
result_t raw_myfunc( tuple posargs, dict kwargs)
{
myfunc
( extract<Type1>(fixed_args[0])()
, extract<Type2>(fixed_args[1])()
, posargs.slice(2,_)
, kwargs
);
)
and then use:
raw_function(raw_myfunc, 2);
And may be you should check out the args :
http://www.boost.org/doc/libs/1_35_0/libs/python/doc/v2/args.html
HTH,
Nikolay Mladenov
More information about the Cplusplus-sig
mailing list