<div dir="ltr"><div>In addition, dict(A, **B) is not something you  easily stumble upon when your goal is "merge two dicts"; nor is it even clear that that's what it is when you read it for the first time.<br>

<br></div>All signs of too-clever hacks in my book.<br></div><div class="gmail_extra"><br><br><div class="gmail_quote">On Mon, Jul 28, 2014 at 8:33 AM,  <span dir="ltr"><<a href="mailto:dw+python-ideas@hmmz.org" target="_blank">dw+python-ideas@hmmz.org</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div class="">On Tue, Jul 29, 2014 at 12:59:51AM +1000, Steven D'Aprano wrote:<br>
<br>
> > One good reason is that people are still convinced "dict(A, **B)"<br>
> > makes some kind of sense.<br>
><br>
> Explain please. dict(A, **B) makes perfect sense to me, and it works<br>
> perfectly too. It's a normal constructor call, using the same syntax<br>
> as any other function or method call. Are you suggesting that it does<br>
> not make sense?<br>
<br>
</div>It worked in Python 2, but Python 3 added code to explicitly prevent the<br>
kwargs mechanism from being abused by passing non-string keys.<br>
Effectively, the only reason it worked was due to a Python 2.x kwargs<br>
implementation detail.<br>
<br>
It took me a while to come to terms with this one too, it was really<br>
quite a nice hack. But that's all it ever was. The domain of valid keys<br>
accepted by **kwargs should never have exceeded the range supported by<br>
the language syntax for declaring keyword arguments.<br>
<br>
<br>
David<br>
<div class="HOEnZb"><div class="h5">_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--Guido van Rossum (<a href="http://python.org/~guido">python.org/~guido</a>)
</div>