diff options
| author | Raymond Hettinger <python@rcn.com> | 2009-03-25 22:45:22 +0000 |
|---|---|---|
| committer | Raymond Hettinger <python@rcn.com> | 2009-03-25 22:45:22 +0000 |
| commit | 52dc06b23cea3c46cdfcfb4e420d4fddcaf29f61 (patch) | |
| tree | c4dd2d0e1b4ec5dd89d666919fcedf438a5bb7a3 /Lib/collections.py | |
| parent | 9611b5ef75446598b8fbd26016fa9cf20548291c (diff) | |
| download | cpython-git-52dc06b23cea3c46cdfcfb4e420d4fddcaf29f61.tar.gz | |
Separate initialization from clearing.
Diffstat (limited to 'Lib/collections.py')
| -rw-r--r-- | Lib/collections.py | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/Lib/collections.py b/Lib/collections.py index 4f3f72606c..002ce9724d 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -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): |
