I have been using nested defaultdict in my code and was planning to switch to sorteddict because of it efficient memory utilisation. Initially I initialised my variable d as:
d = defaultdict(lambda: defaultdict(int))
and now initialising the same as:
d = sorteddict(lambda: sorteddict(int))
Now, when I assign a value to the dict I get key error:
Example:-
d[1][2] = 3
I get the following error.
I have been using nested defaultdict in my code and was planning to switch to sorteddict because of it efficient memory utilisation. Initially I initialised my variable d as: d = defaultdict(lambda: defaultdict(int)) and now initialising the same as: d = sorteddict(lambda: sorteddict(int)) Now, when I assign a value to the dict I get key error: Example:- d[1][2] = 3 I get the following error.
KeyError Traceback (most recent call last)