mirror of
https://github.com/python/cpython.git
synced 2025-12-22 16:39:14 +00:00
SF bug #849662. Dramatically, improve comparison speed for "if shl == None".
This commit is contained in:
parent
edfb30258e
commit
f477c88450
1 changed files with 2 additions and 0 deletions
|
|
@ -155,6 +155,8 @@ class DictMixin:
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return repr(dict(self.iteritems()))
|
return repr(dict(self.iteritems()))
|
||||||
def __cmp__(self, other):
|
def __cmp__(self, other):
|
||||||
|
if other is None:
|
||||||
|
return 1
|
||||||
if isinstance(other, DictMixin):
|
if isinstance(other, DictMixin):
|
||||||
other = dict(other.iteritems())
|
other = dict(other.iteritems())
|
||||||
return cmp(dict(self.iteritems()), other)
|
return cmp(dict(self.iteritems()), other)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue