<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META content="text/html; charset=us-ascii" http-equiv=Content-Type>
<META name=GENERATOR content="MSHTML 8.00.6001.18876"></HEAD>
<BODY>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>Hello.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>I've been crawling
the web for an answer to this one, but have come up empty.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>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.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>Problem:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>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?</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>For instance, this
is defined in a ".py" file.</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>class
Gain:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010> def
__init__( self, *args, **kwargs ):</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>
...</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>In C++ we have
(where "gainClass" is the Gain class above referenced from
C++):</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>-----</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>namespace bp =
boost::python;</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>bp::object
gainObject = gainClass( /* what goes here to call the above Gain constructor? */
);</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>-----</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>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:</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>-----</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>bp::object
gainObject = gainClass( *bp::tuple(), **bp::dict() );</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>-----</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>But this is not
available in Boost 1.36</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010></SPAN></FONT> </DIV>
<DIV><FONT size=2 face=Arial><SPAN
class=932032322-02022010>TIA</SPAN></FONT></DIV>
<DIV><FONT size=2 face=Arial><SPAN class=932032322-02022010>--
Harmon</SPAN></FONT></DIV></SPAN></FONT></DIV></BODY></HTML>