From aff29aeb4726ec044aad67a4075bec69af93dfdc Mon Sep 17 00:00:00 2001 From: Thomas Heller Date: Thu, 4 Dec 2003 21:07:57 +0000 Subject: [PATCH] Backported from the trunk, on Raymond's request: SF bug #849662. Dramatically, improve comparison speed for "if shl == None". --- Lib/UserDict.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Lib/UserDict.py b/Lib/UserDict.py index 6b5c9dade6ac..35f86fc4dc10 100644 --- a/Lib/UserDict.py +++ b/Lib/UserDict.py @@ -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) -- 2.47.3