On Mon, Mar 4, 2019 at 11:41 PM INADA Naoki <songofaca...@gmail.com> wrote:
> Then, I propose `dict.merge` method.  It is outer-place version
> of `dict.update`, but accepts multiple dicts.  (dict.update()
> can be updated to accept multiple dicts, but it's not out of scope).
>
> * d = d1.merge(d2)  # d = d1.copy(); d.update(d2)
> * d = d1.merge(d2, d3)  # d = d1.copy(); d.update(d2); d2.update(d3)
> * d = d1.merge(iter_of_pairs)
> * d = d1.merge(key=value)

Another similar option would be to extend the dict constructor to
allow: d = dict(d1, d2, d3, ...)

-n

-- 
Nathaniel J. Smith -- https://vorpus.org
_______________________________________________
Python-ideas mailing list
Python-ideas@python.org
https://mail.python.org/mailman/listinfo/python-ideas
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to