19 May
2016
19 May
'16
3:01 p.m.
Hello! I have just simple question. python code: a = A() bla = "lala" + a.pp *Traceback (most recent call last):TypeError: cannot concatenate 'str' and 'property' objects* Why it is not work? How make it is work? boost c++ code: #include <boost/python/module.hpp> #include <boost/python/def.hpp> #include <boost/python/class.hpp> #include <boost/python/init.hpp> class A { public: std::string pp; A(): pp("babla") {}; }; using namespace boost::python; BOOST_PYTHON_MODULE (test1) { class_<A> ("A") .def(py::init<>()) .add_property ("pp", &A::pp) ; } Thanks, Sergiy