[C++-sig] iterate through boot::python::list
dave at boost-consulting.com
Fri Mar 7 19:52:56 CET 2003
harold fellermann <harold at imb-jena.de> writes:
> Is there any possibility to iterate trough a boost::python::list (or
> from within C++ ? I could not find anything in the documentation.
Well, for a list you can call x.attr("__len__")() to get its length
and index it.
For a dictionary you can call items() and then do the same.
However, it would be interesting to make a standard input_iterator
that could iterate over the items, e.g.:
input_iterator i = begin(some_list_or_dict);
i != end(some_list_or_dict);
Nice project for someone who wants to make a contribution.
More information about the Cplusplus-sig