[Python-ideas] Dict joining using + and +=

fhsxfhsx fhsxfhsx at 126.com
Fri Mar 1 00:36:45 EST 2019


Considering potential ambiguity, I suggest `d1.append(d2)` so we can have an additional argument saying `d1.append(d2, mode="some mode that tells how this function behaviours")`.
If we are really to have the new syntax `d1 + d2`, I suggest leaving it for `d1.append(d2, mode="strict")` which raises an error when there're duplicate keys. The semantics is nature and clear when two dicts have no overlapping keys.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190301/3d5ac407/attachment.html>


More information about the Python-ideas mailing list