[C++-sig] boost::python::dict problem
Ravi
lists_ravi at lavabit.com
Wed Oct 1 21:10:18 CEST 2008
On Wednesday 01 October 2008 09:00:23 Martin Walser wrote:
> 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!
This is a bug in your code. test[1,17] is actually test[17] since C++ rules
for evaluating the expression "1,17" results in the value 17. I would not
expect C++ to follow python rules and make it into a tuple. Even "(1,17)"
would still evaluate in C++ to 17. You need, as Ralf pointed out, make_tuple
or something else that returns a python tuple rather than an expression that
returns a single int.
Regards,
Ravi
More information about the Cplusplus-sig
mailing list