
25 Jul
2007
25 Jul
'07
7:55 a.m.
FWIW, I think the boost::python doc really lack small example of simple things, like: 1) How am I supposed to iterate over boost::python::object::operator[] ? 2) How am I supposed to iterate over boost::python::object::attr() ? After googling a lot I found out that for 2) I could do : boost::python::dict = boost::python::extract<boost::python::dict>(obj.attr ("__dict__")); boost::python::object it = dict.iterkeys(); while(it) { // use boost::python::extract<yourtype>(it()) here it.attr("next")(); } But to find that out I really had to sweat. And I'm still looking for 1)... and not close to find out because few people embed python into C++. Philippe