[C++-sig] dict.has_key works in a Python script, not in C++

2010-03-03 Thread Guillaume Seguin
I have a C++ object (named hello) exposed in a Python extension using boost::python version 1.42. This code works : import my_ext aaa = my_ext.hello('aaa') d = { aaa:12345 } assert aaa in d #This assertion is true, as expected assert d.has_key(aaa) #This assertion is true, as expected But if I

Re: [C++-sig] dict.has_key works in a Python script, not in C++

2010-03-03 Thread Stefan Seefeld
On 03/03/2010 02:10 PM, Guillaume Seguin wrote: I have a C++ object (named hello) exposed in a Python extension using boost::python version 1.42. This code works : import my_ext aaa = my_ext.hello('aaa') d = { aaa:12345 } assert aaa in d #This assertion is true, as expected assert d.has_key(

Re: [C++-sig] dict.has_key works in a Python script, not in C++

2010-03-03 Thread Jim Bosch
On Wed, 2010-03-03 at 15:35 -0500, Stefan Seefeld wrote: > > > > I tried stepping through the code with gdb, but I got lost ... What am > > I missing ? TIA > > Python requires dictionary keys to be immutable. I wouldn't be surprised > if it used object identity checks (such as address comparis