[C++-sig] wrapped std::vector slice affecting items in a python list

babak babakage at gmail.com
Fri Aug 12 13:28:36 CEST 2011


I've come across some unusual behaviour that I was hoping some one might be
able to explain to me. 

In python I have a list and a wrapped std::vector<MyCustomType> (using the
vector_indexing_suite) where the list contains the items in the vector. If I
slice insert items into the vector then the items in the python list change.
The attached example illustrates this.

Is this behaviour expected ? 

I'm quite confused as to what's going on so any help clarifying this would
be greatly appreciated.

http://boost.2283326.n4.nabble.com/file/n3738972/test.py test.py 
http://boost.2283326.n4.nabble.com/file/n3738972/source.cpp source.cpp 

View this message in context: http://boost.2283326.n4.nabble.com/wrapped-std-vector-slice-affecting-items-in-a-python-list-tp3738972p3738972.html
Sent from the Python - c++-sig mailing list archive at Nabble.com.

More information about the Cplusplus-sig mailing list