I am trying to combine two multi-element dictionaries but am running into a problem.
From the example below, what I expected was the dictionary x to contain all three unique combinations.
What seems to have happened is that the y dictionary overwrote the x dictionary.
Am I just using this wrong? Is there a elegant way to add two multi element dictionaies?
thanks!
>>> x=nested_dict()
>>> y=nested_dict()
>>>
>>> x[1][1]=1
>>> x[1][2]=2
>>> y[1][3]=3
>>> x.update(y)
>>> print x
defaultdict(<class 'nested_dict.nested_dict'>, {1: defaultdict(<class 'nested_dict.nested_dict'>, {3: 3})})