<div dir="ltr">I'm also fine with saying that keys in **kwargs that are not proper identifiers is an implementation detail.<br></div><br><div class="gmail_quote"><div dir="ltr">On Thu, 4 Oct 2018 at 02:20, Serhiy Storchaka <<a href="mailto:storchaka@gmail.com">storchaka@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">04.10.18 11:56, Steven D'Aprano пише:<br>
> While keyword arguments have to be identifiers, using **kwargs allows<br>
> arbitrary strings which aren't identifiers:<br>
> <br>
> py> def spam(**kwargs):<br>
> ....     print(kwargs)<br>
> ....<br>
> py> spam(**{"something arbitrary": 1, '\n': 2})<br>
> {'something arbitrary': 1, '\n': 2}<br>
> <br>
> <br>
> There is some discussion on Python-Ideas on whether or not that<br>
> behaviour ought to be considered a language feature, an accident of<br>
> implementation, or a bug.<br>
> <br>
> Can we get some guidence on this please?<br>
<br>
This is an implementation detail. Currently CPython doesn't ensure that <br>
keyword argument names are identifiers for performance reasons. But this <br>
can be changed in future versions or in other implementations.<br>
<br>
_______________________________________________<br>
Python-Dev mailing list<br>
<a href="mailto:Python-Dev@python.org" target="_blank">Python-Dev@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-dev" rel="noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-dev</a><br>
Unsubscribe: <a href="https://mail.python.org/mailman/options/python-dev/brett%40python.org" rel="noreferrer" target="_blank">https://mail.python.org/mailman/options/python-dev/brett%40python.org</a><br>
</blockquote></div>