Is there any way to calculate length of list passed from python to C++? I want do do
something like this, but list class lacks length
(or anything similar) method:
class Awesome{
public:
void awesomeMethod(const boost::python::list& list_of_something){
list_of_something.length() // suprisingly there's no such method
}
};
Like Python, you should use the free function len()
to get the length. Try
boost::python::len(list_of_something)