<div dir="ltr"><div>There's a long thread about the subject: <a href="https://mail.python.org/pipermail/python-ideas/2015-February/031748.html">https://mail.python.org/pipermail/python-ideas/2015-February/031748.html</a><br><br></div><div>I suggest to avoid the matter altogether :)<br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Thu, Apr 12, 2018 at 4:15 PM, Mike Miller <span dir="ltr"><<a href="mailto:python-ideas@mgmiller.net" target="_blank">python-ideas@mgmiller.net</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">While we're on the subject, I've tried to add dicts a few times over the years to get a new one but it doesn't work:<br>
<br>
    d3 = d1 + d2  # TypeError<br>
<br>
Thinking a bit, set union is probably a better analogue, but it doesn't work either:<br>
<br>
    d3 = d1 | d2  # TypeError<br>
<br>
Where the last value of any duplicate keys should win.<span class="HOEnZb"><font color="#888888"><br>
<br>
-Mike</font></span><span class="im HOEnZb"><br>
<br>
<br>
<br>
On 2018-04-12 06:46, Andrés Delfino wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Extending the original idea, IMHO it would make sense for the dict constructor to create a new dictionary not only from several mappings, but mixing mappings and iterables too.<br>
<br>
Consider this example:<br>
<br>
x = [(1, 'one')]<br>
y = {2: 'two'}<br>
<br>
Now: {**dict(x), **y}<br>
Proposed: dict(x, y)<br>
</blockquote></span><div class="HOEnZb"><div class="h5">
______________________________<wbr>_________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer" target="_blank">https://mail.python.org/mailma<wbr>n/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer" target="_blank">http://python.org/psf/codeofco<wbr>nduct/</a><br>
</div></div></blockquote></div><br></div>