Re: [C++-sig] accessing nontrivial types

2010-02-05 Thread Anders Wallin
> 3) > bp::list getter (const MyClass& self) > { >        bp::list L >        //move the values in self.ilist to L >        return L > } > void setter (const MyClass& self, bp::list L) > { >        //move the values in L to self.ilist > } > > class_("Myclass") >        .def_readwrite("i", &Myclass:

Re: [C++-sig] Getting a b::p::object for a PyObject and vice-versa.

2010-02-05 Thread Ralf W. Grosse-Kunstleve
What you do looks right. bp::object(bp::handle<>(c_object)) may be a little shorter in some places. (Watch out for compilers confusing your code with function declarations.) bpobj.ptr() will give you the PyObject* directly. bphdl.get() does the same for handle<>. (Improvements are always welco