   boost python vector indexing suite
  How do I fix my python vector code below?import Datadef getdata():data = Data.vectorVectorString()data[] = [[unicode('aaa'), unicode('aaa'), unicode('aaa')], [unicode('fff'), unicode('fff'), unicode('fff')], [unicode('bbb'), unicode('bbb'), unicode('bbb')]]cpp codeBOOST_PYTHON_MODULE(Data){ class_<std::vector<std::vector<std::wstring>>>("vectorVectorString") .def(vector_indexing_suite<std::vector<std::vector<std::wstring>>>());}Thx ahead of timeJacob Jingle[Edited by - Jacob Jingle on June 2, 2010 4:08:40 PM]
  What's the problem? Compile error? Runtime error?   ;Quote:Original post by SiCraneWhat's the problem? Compile error? Runtime error?Using your sweet exception code I get:File "G:\data.py", line 6 data[] = [[unicode('aaa'), unicode('aaa'), unicode('aaa')], [unicode('fff'), unicode('fff'), unicode('fff')], [unicode('bbb'), unicode('bbb'), unicode('bbb')]] ^ SyntaxError: invalid syntax ;  The syntax error it's complaining about is data[]. If you're doing a slice assignment you want data[:]. That said, you're also probably going to have troubles because you haven't also registered std::vector<std::wstring>.   ;  I'm surprised the >>> bit in C++ compiles, to be honest. I would have expected to have to put > > > instead. Maybe compilers are getting smarter.   ;  It'll be officially legal with C++0x, but MSVC has accepted it since 2005.   