Separate initialization from clearing.

This commit is contained in:
Raymond Hettinger 2009-03-25 22:45:22 +00:00
parent 9611b5ef75
commit 52dc06b23c
1 changed files with 4 additions and 3 deletions

View File

@ -41,14 +41,15 @@ def __init__(self, *args, **kwds):
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):