[C++-sig] a question about boost python

Roman Yakovenko roman.yakovenko at gmail.com
Tue Oct 16 12:23:55 CEST 2007


On 10/16/07, Chang Chen <Chang_Chen at sonic.com> wrote:
>
>  Hi All
>
> I have a set of functions which last parameters are out-parameter. i.e.
>
>   void  function1(int  t1, float t2, string& t3) ;
>
> I want to expose these functions in python, but such definition (~def("
> function1", function1)~) is not what I want.
>
> Because we have to write python code like this:
>
>    strTest=''
>
>    function1(1,2.0,strTest);
>
> I prefer to writing python code like this
>
>    strTest = funciton1(1,2.0)
>
> Is there any idea to solve this question?
>
In short: to create another function, with the desired interface. In your
case you just don't have other choice - std::string is mapped to Python
string, which is immutable.

Read more here:
http://language-binding.net/pyplusplus/documentation/functions/transformation/built_in/output.html

-- 
Roman Yakovenko
C++ Python language binding
http://www.language-binding.net/
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/cplusplus-sig/attachments/20071016/b7b91725/attachment.htm>


More information about the Cplusplus-sig mailing list