From: Raymond Hettinger Date: Tue, 3 Mar 2009 22:42:48 +0000 (+0000) Subject: Now that __keys are fully hidden, switch the underlying structure X-Git-Tag: v3.1a1~39 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=89194ff2807e040804c2fa8a92a1da04844471a2;p=python 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. --- diff --git a/Lib/collections.py b/Lib/collections.py index a1e8ed975b..2b0de18768 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):