You have to do something like that using namespace boost::python;
BOOST_PYTHON_MODULE(my_module) { struct wrapper{ static tuple bar(Foo & f){ double a, b; f.bar(a,b); return make_tuple(a,b); } }; class_<Foo>("Foo", init<>()) .def("bar", &wrapper::bar) ; } and in python it will be: >>> a,b = Foo().bar() On Mon, May 25, 2015 at 5:39 AM, Trigve Siver via Cplusplus-sig < cplusplus-sig@python.org> wrote: > > > ----- Original Message ----- > > From: Jason Addison <jraddi...@gmail.com> > > To: cplusplus-sig@python.org > > Cc: > > Sent: Saturday, May 23, 2015 6:05 PM > > Subject: [C++-sig] Returning values to Python in C++ reference arguments > > > > How can results be returned in function arguments? > > > > > I don't think that you can return arguments by reference/pointers in > python. You could theoretically pass a mutable sequence (list) and push the > objects there. > > But the common approach is to return tuple. > _______________________________________________ > Cplusplus-sig mailing list > Cplusplus-sig@python.org > https://mail.python.org/mailman/listinfo/cplusplus-sig >
_______________________________________________ Cplusplus-sig mailing list Cplusplus-sig@python.org https://mail.python.org/mailman/listinfo/cplusplus-sig