Python keyword args can be any string

Rustom Mody rustompmody at gmail.com
Fri Feb 19 06:41:55 EST 2016


On Thursday, February 18, 2016 at 11:12:45 AM UTC+5:30, 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}
> 

Hoo boy!
Namespaces are a honking great idea though sometimes the honk is too loud

> 
> Bug or feature?

Dunno...
I dont like it



More information about the Python-list mailing list