mirror of
https://github.com/python/cpython.git
synced 2025-08-31 14:07:50 +00:00
Missed my last update to __eq__ to check matching length.
This commit is contained in:
parent
2d32f63ec9
commit
ea9f8db2a2
1 changed files with 2 additions and 3 deletions
|
@ -11,8 +11,7 @@ from operator import itemgetter as _itemgetter
|
||||||
from keyword import iskeyword as _iskeyword
|
from keyword import iskeyword as _iskeyword
|
||||||
import sys as _sys
|
import sys as _sys
|
||||||
import heapq as _heapq
|
import heapq as _heapq
|
||||||
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap, \
|
from itertools import repeat as _repeat, chain as _chain, starmap as _starmap
|
||||||
zip_longest as _zip_longest
|
|
||||||
|
|
||||||
################################################################################
|
################################################################################
|
||||||
### OrderedDict
|
### OrderedDict
|
||||||
|
@ -83,7 +82,7 @@ class OrderedDict(dict, MutableMapping):
|
||||||
|
|
||||||
def __eq__(self, other):
|
def __eq__(self, other):
|
||||||
if isinstance(other, OrderedDict):
|
if isinstance(other, OrderedDict):
|
||||||
return all(p==q for p, q in _zip_longest(self.items(), other.items()))
|
return len(self)==len(other) and all(p==q for p, q in zip(self.items(), other.items()))
|
||||||
return dict.__eq__(self, other)
|
return dict.__eq__(self, other)
|
||||||
|
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue