[C++-sig] Clearing lists in boost-python

2011-06-22 Thread charles75
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’.

Is there another way of clearing the list?

Thanks in advance for any help.


--
View this message in context: 
http://boost.2283326.n4.nabble.com/Clearing-lists-in-boost-python-tp3617273p3617273.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Clearing lists in boost-python

2011-06-22 Thread Stefan Seefeld

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
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig

Re: [C++-sig] Clearing lists in boost-python

2011-06-22 Thread charles75
Thanks Stefan.

I did try your suggestion but unfortunately the linker gave me errors
regarding del and slice.

Thanks anyway.

--
View this message in context: 
http://boost.2283326.n4.nabble.com/Clearing-lists-in-boost-python-tp3617273p3617362.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.
___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig


Re: [C++-sig] Clearing lists in boost-python

2011-06-22 Thread Stefan Seefeld

On 2011-06-22 11:38, charles75 wrote:

Thanks Stefan.

I did try your suggestion but unfortunately the linker gave me errors
regarding del and slice.


Without more details it's impossible to help further, sorry.

Stefan

--

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

___
Cplusplus-sig mailing list
[email protected]
http://mail.python.org/mailman/listinfo/cplusplus-sig