[Python-checkins] cpython: Improve OrderedDict equality test.

raymond.hettinger python-checkins at python.org
Fri Dec 7 19:18:42 CET 2012


http://hg.python.org/cpython/rev/026b9f5dd97f
changeset:   80740:026b9f5dd97f
user:        Raymond Hettinger <python at rcn.com>
date:        Fri Dec 07 10:18:22 2012 -0800
summary:
  Improve OrderedDict equality test.

files:
  Lib/collections/__init__.py |  3 +--
  1 files changed, 1 insertions(+), 2 deletions(-)


diff --git a/Lib/collections/__init__.py b/Lib/collections/__init__.py
--- a/Lib/collections/__init__.py
+++ b/Lib/collections/__init__.py
@@ -228,8 +228,7 @@
 
         '''
         if isinstance(other, OrderedDict):
-            return len(self)==len(other) and \
-                   all(map(_eq, self.items(), other.items()))
+            return dict.__eq__(self, other) and all(map(_eq, self, other))
         return dict.__eq__(self, other)
 
 

-- 
Repository URL: http://hg.python.org/cpython


More information about the Python-checkins mailing list