On Thu, 18 Feb 2016 06:55 pm, Mark Lawrence wrote: > 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?
A work colleague wanted to pass an argument starting with "-" to a function. Apparently he didn't have a specific argument in mind. He just wanted to test the function to breaking point by passing invalid argument names. -- Steven -- https://mail.python.org/mailman/listinfo/python-list