A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2018-October/155437.html below:

[Python-Dev] Arbitrary non-identifier string keys when using **kwargs

[Python-Dev] Arbitrary non-identifier string keys when using **kwargs [Python-Dev] Arbitrary non-identifier string keys when using **kwargsSerhiy Storchaka storchaka at gmail.com
Thu Oct 4 05:18:43 EDT 2018
04.10.18 11:56, Steven D'Aprano пише:
> While keyword arguments have to be identifiers, using **kwargs allows
> arbitrary strings which aren't identifiers:
> 
> py> def spam(**kwargs):
> ....     print(kwargs)
> ....
> py> spam(**{"something arbitrary": 1, '\n': 2})
> {'something arbitrary': 1, '\n': 2}
> 
> 
> There is some discussion on Python-Ideas on whether or not that
> behaviour ought to be considered a language feature, an accident of
> implementation, or a bug.
> 
> Can we get some guidence on this please?

This is an implementation detail. Currently CPython doesn't ensure that 
keyword argument names are identifiers for performance reasons. But this 
can be changed in future versions or in other implementations.

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4