Python keyword args can be any string

Mark Lawrence breamoreboy at yahoo.co.uk
Thu Feb 18 02:55:59 EST 2016


On 18/02/2016 05:42, Steven D'Aprano wrote:
> 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?
>

I'm not sure, but what on earth got you to this in the first place?

-- 
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence



More information about the Python-list mailing list