Is there a way to calculate the length of a list passed from python to C ++? I want to do something like this, but the length method (or something similar) is missing from the list of classes:
length
class Awesome{ public: void awesomeMethod(const boost::python::list& list_of_something){ list_of_something.length() // suprisingly there no such method } };
Like Python , you must use the free len() function to get the length. Try
len()
boost::python::len(list_of_something)
It is called len , not length , and it is not a method, but an independent function (Python does not use the length methods, but the length protocol and len() ).
len
return boost::python::len(list_of_something);
Source: https://habr.com/ru/post/903804/More articles:Nokogiri xpath () or operator? - ruby | fooobar.comstored procedures calling data in another schema - sql-serverAndroid MediaPlayer stuck in preparation mode () - androidPerl IDE standard input not working - perlgit basic setup - gitWhat is the easiest * correct * method for detecting rectangles in an image? - c ++Multiple Challenges in Octaves - plotGNUEmacs / ESS / Latex / Sweave: text is displayed differently when the cursor is in latex code or in R - rXForwardedSupport for https! support for the absence of Geroku - playframeworkCreate file in resource / source folder in Java programmatically? - javaAll Articles