commit | f477c884509ad5e6a4d2ef583dae9eb1cd6d125d | [log] [tgz] |
---|---|---|
author | Raymond Hettinger <python@rcn.com> | Thu Dec 04 20:04:09 2003 +0000 |
committer | Raymond Hettinger <python@rcn.com> | Thu Dec 04 20:04:09 2003 +0000 |
tree | 5389ed6d182f236d9304ec5e3075da974e946e40 | |
parent | edfb30258ea262cb67c1e48e4b122bf7e1b8b674 [diff] |
SF bug #849662. Dramatically, improve comparison speed for "if shl == None".
diff --git a/Lib/UserDict.py b/Lib/UserDict.py index 6b5c9da..35f86fc 100644 --- a/Lib/UserDict.py +++ b/Lib/UserDict.py
@@ -155,6 +155,8 @@ 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)