tr fp)
{
    fp(&quot;hello,world!&quot;);
}

BOOST_PYTHON_MODULE(test)
{
    def(&quot;foo&quot;,foo) ;
}
</pre>

And then:

<pre>
&gt;&gt;&gt; def hello(s):
...    print s
...
&gt;&gt;&gt; foo(hello)
hello, world!
</pre>

    The short answer is: &quot;you can't&quot;.  This is not a
    Boost.Python limitation so much as a limitation of C++.  The
    problem is that a Python function is actually data, and the only
    way of associating data with a C++ function pointer is to store it
    in a static vari