Calling a "raw" python function from C++
hnine at isis.vanderbilt.edu
Tue Feb 2 23:38:00 CET 2010
I've been crawling the web for an answer to this one, but have come up
We can currently only use Boost 1.36 for our project, i.e. we are having
problems using later versions of Boost. We are using Boost.Python to
interface with Cheetah.
In Boost 1.36, how do you call a "raw" method of a python class from
C++? In particular, what C++ code is needed to call a "raw
constructor", i.e. a constructor that can take an arbitrary number of
positional and keyword arguments by using *args, **kwargs?
For instance, this is defined in a ".py" file.
def __init__( self, *args, **kwargs ):
In C++ we have (where "gainClass" is the Gain class above referenced
namespace bp = boost::python;
bp::object gainObject = gainClass( /* what goes here to call the above
Gain constructor? */ );
Passing a tuple and a dict doesn't work. I wish we could use the most
recent version of Boost, since in this you can just do this:
bp::object gainObject = gainClass( *bp::tuple(), **bp::dict() );
But this is not available in Boost 1.36
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the Python-list