]> granicus.if.org Git - python/commitdiff
SF bug #849662. Dramatically, improve comparison speed for "if shl == None".
authorRaymond Hettinger <python@rcn.com>
Thu, 4 Dec 2003 20:04:09 +0000 (20:04 +0000)
committerRaymond Hettinger <python@rcn.com>
Thu, 4 Dec 2003 20:04:09 +0000 (20:04 +0000)
Lib/UserDict.py

index 6b5c9dade6ac694431b34821a23083e10ecac2e6..35f86fc4dc1076ad0eeeb862e44d290552657297 100644 (file)
@@ -155,6 +155,8 @@ class DictMixin:
     def __repr__(self):
         return repr(dict(self.iteritems()))
     def __cmp__(self, other):
+        if other is None:
+            return 1
         if isinstance(other, DictMixin):
             other = dict(other.iteritems())
         return cmp(dict(self.iteritems()), other)