Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 6951380

Browse files
committed
Update UserDict.
1 parent 28c5c56 commit 6951380

1 file changed

Lines changed: 12 additions & 12 deletions

File tree

Lib/collections/__init__.py

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -982,25 +982,25 @@ def __contains__(self, key):
982982
# Now, add the methods in dicts but not in MutableMapping
983983
def __repr__(self): return repr(self.data)
984984

985-
def __add__(self, other):
985+
def __or__(self, other):
986986
if isinstance(other, UserDict):
987-
return self.__class__(self.data + other.data)
987+
return self.__class__(self.data | other.data)
988988
if isinstance(other, type(self.data)):
989-
return self.__class__(self.data + other)
990-
return self.__class__(self.data + dict(other))
991-
def __radd__(self, other):
989+
return self.__class__(self.data | other)
990+
return self.__class__(self.data | dict(other))
991+
def __ror__(self, other):
992992
if isinstance(other, UserDict):
993-
return self.__class__(other.data + self.data)
993+
return self.__class__(other.data | self.data)
994994
if isinstance(other, type(self.data)):
995-
return self.__class__(other + self.data)
996-
return self.__class__(dict(other) + self.data)
997-
def __iadd__(self, other):
995+
return self.__class__(other | self.data)
996+
return self.__class__(dict(other) | self.data)
997+
def __ior__(self, other):
998998
if isinstance(other, UserDict):
999-
self.data += other.data
999+
self.data |= other.data
10001000
elif isinstance(other, type(self.data)):
1001-
self.data += other
1001+
self.data |= other
10021002
else:
1003-
self.data += dict(other)
1003+
self.data |= dict(other)
10041004
return self
10051005

10061006
def __copy__(self):

0 commit comments

Comments
 (0)