Hello,

I have a C++ class wrapped with swig. I add it as a key in a dictionary as
follows:

my_key = swigclass() # create class
my_value = another_swigclass() # create 2nd class
my_dict = {}

my_dict[ my_key] = my_value

If I print my_dict, it shows the expected key:value pair there. It displays
the wrapped values (i.e. a string with the pointer values and object type
embedded )

if I then access the value:

my_dict[ my_key]

it gives me the correct object (my_value) as expected

Then, in another function, I try the same access on the same dictionary,
(again after printing the dictionary contents to make sure it has 'my_key' )

my_dict[ my_key]

this generates a KeyError exception. I have no idea why, since the key is
clearly valid and present in the dictionary.

If I add a string key:value pair (eg. "test key" : "test value" ) to that
same dictionary, and try to access "test key", that works fine .

Can anyone help ?
Thanks,
Chris
_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to