Python keyword args can be any string

Steven D'Aprano steve+comp.lang.python at pearwood.info
Thu Feb 18 00:42:17 EST 2016


Today I learned that **kwargs style keyword arguments can be any string:


py> def test(**kw):
...     print(kw)
... 
py> kwargs = {'abc-def': 42, '': 23, '---': 999, '123': 17}
py> test(**kwargs)
{'': 23, '123': 17, '---': 999, 'abc-def': 42}


Bug or feature?



-- 
Steve




More information about the Python-list mailing list