[Python-checkins] r70602 - python/branches/py3k/Lib/collections.py

raymond.hettinger python-checkins at python.org
Wed Mar 25 23:45:23 CET 2009


Author: raymond.hettinger
Date: Wed Mar 25 23:45:22 2009
New Revision: 70602

Log:
Separate initialization from clearing.

Modified:
   python/branches/py3k/Lib/collections.py

Modified: python/branches/py3k/Lib/collections.py
==============================================================================
--- python/branches/py3k/Lib/collections.py	(original)
+++ python/branches/py3k/Lib/collections.py	Wed Mar 25 23:45:22 2009
@@ -41,14 +41,15 @@
         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):


More information about the Python-checkins mailing list