[C++-sig] boost::python::dict problem
Martin Walser
martin.walser at gmx.de
Wed Oct 1 15:00:23 CEST 2008
Hello! :)
Hmm... something odd's happening here when I'm trying to use a dict in my
boost python C++ Extension:
C++ Extension Code:
dict testdict;
...
testdict[1,17]="huhu";
string test = extract<string>(testdict[1,17]); //access to
dict: works!
mLog->log(test); //writes test string to log... output: "huhu":
works!
But if I want to access the testdict class member in Python like here:
Python Code:
print self.myCExtension.testdict
I get this output:
{17: 'huhu'}
While it should be {(1,17): 'huhu'}
Doing this with a bigger dict results in a output were most entries are
missing.
When I output them in C++ all are there.
Accessing with self.myCExtension.testdict[1,17] in python doesn't work
either of course:
KeyError: (1, 17)
Hum...
ravening beast... this boost::python.
Martin
More information about the Cplusplus-sig
mailing list