[Python-Dev] Arbitrary non-identifier string keys when using **kwargs (original) (raw)
Steven D'Aprano steve at pearwood.info
Thu Oct 4 04:56:34 EDT 2018
- Previous message (by thread): [Python-Dev] AIX to stable, what does that take?
- Next message (by thread): [Python-Dev] Arbitrary non-identifier string keys when using **kwargs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
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?
Thanks,
-- Steve
- Previous message (by thread): [Python-Dev] AIX to stable, what does that take?
- Next message (by thread): [Python-Dev] Arbitrary non-identifier string keys when using **kwargs
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]