On 2011-06-22 11:04, charles75 wrote:
Hi,

I've been trying to clear a list of dictionaries from a list without
success.
The code below is a simple example of what I'm trying to achieve.

dict a, b;
list mylist;

mylist.append(a);
mylist.append(b);

mylist.clear();
When I type in the last statement I get the error below from the linker
‘class boost::python::list’ has no member named ‘clear’.

Right, and neither does the Python 'list' type have such a method.

Is there another way of clearing the list?

In Python you'd probably do something like

  del mylist[:]

The equivalent of that in C++ is

  del(mylist[slice()]);

    Stefan

--

      ...ich hab' noch einen Koffer in Berlin...

_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig

Reply via email to