Kaydet (Commit) 906f95e8 authored tarafından Raymond Hettinger's avatar Raymond Hettinger

Move initialization of root link to __init__.

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