summaryrefslogtreecommitdiffstats
path: root/Lib/_abcoll.py
diff options
context:
space:
mode:
Diffstat (limited to 'Lib/_abcoll.py')
-rw-r--r--Lib/_abcoll.py12
1 files changed, 12 insertions, 0 deletions
diff --git a/Lib/_abcoll.py b/Lib/_abcoll.py
index 005f437..de6e6f8 100644
--- a/Lib/_abcoll.py
+++ b/Lib/_abcoll.py
@@ -378,6 +378,11 @@ class Mapping(metaclass=ABCMeta):
def values(self):
return ValuesView(self)
+ def __eq__(self, other):
+ return set(self) == set(other)
+
+ def __ne__(self, other):
+ return set(self) == set(other)
class MappingView(metaclass=ABCMeta):
@@ -485,6 +490,13 @@ class MutableMapping(Mapping):
for key, value in kwds.items():
self[key] = value
+ def setdefault(self, key, default=None):
+ try:
+ return self[key]
+ except KeyError:
+ self[key] = default
+ return default
+
MutableMapping.register(dict)