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

raymond.hettinger python-checkins at python.org
Mon Mar 2 22:28:41 CET 2009


Author: raymond.hettinger
Date: Mon Mar  2 22:28:41 2009
New Revision: 70102

Log:
Missed my last update to __eq__ to check matching length.

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	Mon Mar  2 22:28:41 2009
@@ -11,8 +11,7 @@
 from keyword import iskeyword as _iskeyword
 import sys as _sys
 import heapq as _heapq
-from itertools import repeat as _repeat, chain as _chain, starmap as _starmap, \
-                      zip_longest as _zip_longest
+from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
 
 ################################################################################
 ### OrderedDict
@@ -83,7 +82,7 @@
 
     def __eq__(self, other):
         if isinstance(other, OrderedDict):
-            return all(p==q for p, q in  _zip_longest(self.items(), other.items()))
+            return len(self)==len(other) and all(p==q for p, q in  zip(self.items(), other.items()))
         return dict.__eq__(self, other)
 
 


More information about the Python-checkins mailing list