[issue36144] Dictionary union. (PEP 584)
Serhiy Storchaka
report at bugs.python.org
Thu Feb 27 15:00:33 EST 2020
Serhiy Storchaka <storchaka+cpython at gmail.com> added the comment:
1.
def __or__(self, other):
return self.__class__(self.maps[0] | other, *self.maps[1:])
def __ror__(self, other):
return other | dict(self)
2.
def __or__(self, other):
return self.__class__(other, *self.maps)
def __ror__(self, other):
return self.__class__(*self.maps, other)
There are problems with both variants, so I think it may be better to not add this operator to ChainMap.
----------
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36144>
_______________________________________
More information about the Python-bugs-list
mailing list