diff options
author | Raymond Hettinger <python@rcn.com> | 2009-03-03 22:42:48 (GMT) |
---|---|---|
committer | Raymond Hettinger <python@rcn.com> | 2009-03-03 22:42:48 (GMT) |
commit | 89194ff2807e040804c2fa8a92a1da04844471a2 (patch) | |
tree | 7b07927907a84b1ee9fee4ebfa92cf2d48a4812e /Lib/collections.py | |
parent | 0c9881782bc1a72fb9fda571bee195c242160de9 (diff) | |
download | cpython-89194ff2807e040804c2fa8a92a1da04844471a2.zip cpython-89194ff2807e040804c2fa8a92a1da04844471a2.tar.gz cpython-89194ff2807e040804c2fa8a92a1da04844471a2.tar.bz2 |
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.
Diffstat (limited to 'Lib/collections.py')
-rw-r--r-- | Lib/collections.py | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index a1e8ed9..2b0de18 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -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): |