DanielStutzbach / blist

A list-like type with better asymptotic performance and similar performance on small lists
Other
310 stars 36 forks source link

Not Able to created nested sorteddict. #86

Open javiyaparth opened 4 years ago

javiyaparth commented 4 years ago

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)

in ----> 1 d[1][2] = 3 ~/.local/lib/python3.6/site-packages/blist/_sorteddict.py in __getitem__(self, key) 114 115 def __getitem__(self, key): --> 116 return self._map[key] 117 118 def __iter__(self): KeyError: 1