Commit 89194ff2 authored by Raymond Hettinger's avatar Raymond Hettinger

Now that __keys are fully hidden, switch the underlying structure

to deque() which futher reduces the temptation to index or resort.
Also, it is a bit faster for some cases.
parent 0c988178
......@@ -27,11 +27,11 @@ class OrderedDict(dict, MutableMapping):
except AttributeError:
# Note the underlying data structure for this class is likely to
# change in the future. Do not rely on it or access it directly.
self.__keys = []
self.__keys = deque()
self.update(*args, **kwds)
def clear(self):
del self.__keys[:]
self.__keys.clear()
dict.clear(self)
def __setitem__(self, key, value):
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment