Kaydet (Commit) 2dc90fdf authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Separate initialization from clearing.

üst 2f6f7436
......@@ -41,14 +41,15 @@ class OrderedDict(dict, MutableMapping):
try:
self.__root
except AttributeError:
self.__root = _Link() # sentinel node for the doubly linked list
self.clear()
self.__root = root = _Link() # sentinel node for the doubly linked list
root.prev = root.next = root
self.__map = {}
self.update(*args, **kwds)
def clear(self):
root = self.__root
root.prev = root.next = root
self.__map = {}
self.__map.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