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

Ivan Levkivskyi levkivskyi at gmail.com
Fri Mar 1 04:07:04 EST 2019

On Thu, 28 Feb 2019 at 07:18, Serhiy Storchaka <storchaka at gmail.com> wrote:

> [...]
> I do not understand why we discuss a new syntax for dict merging if we
> already have a syntax for dict merging: {**d1, **d2} (which works with
> *all* mappings). Is not this contradicts the Zen?

FWIW there are already three ways for lists/sequences:

[*x, *y]
x + y
x.extend(y)  # in-place version

We already have first and third for dicts/mappings, I don't see a big
problem in adding a + for dicts,
also this is not really a new syntax, just implementing couple dunders for
a builtin class.

So I actually like this idea.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190301/caca3975/attachment.html>

More information about the Python-ideas mailing list