[issue36144] Dictionary union. (PEP 584)

Guido van Rossum report at bugs.python.org
Thu Feb 27 10:43:45 EST 2020


Guido van Rossum <guido at python.org> added the comment:

I had just come to a different conclusion. Maybe ChainMap should just not
grow `|` and `|=` operators? That way there can be no confusion. `dict() |
ChainMap()` and `ChainMap() | dict()` will fail because ChainMap doesn't
inherit from dict. (Note that in your last message, `d1 |= cm2` will fail
for this reason. You can of course fix that with `d1 |= dict(cm2)`,
although IIUC there's no reason one of the maps couldn't be some other
[Mutable]Mapping.)

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36144>
_______________________________________


More information about the Python-bugs-list mailing list