[Python-ideas] Syntax for allowing extra keys when unpacking a dict as keyword arguments

Bruce Leban bruce at leban.us
Fri Apr 12 11:25:20 EDT 2019


On Fri, Apr 12, 2019, 8:12 AM Viktor Roytman <viktor.roytman at gmail.com
wrote:

>
>     >>> func(**{'a': 1, 'b': 2})
>     Traceback (most recent call last):
>       File "<stdin>", line 1, in <module>
>     TypeError: func() got an unexpected keyword argument 'b'
>

Perhaps func(***kws)?

I think this is a real problem given the frequent convention that you can
freely add fields to json objects with the additional fields to be ignored.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190412/20dd3c61/attachment.html>


More information about the Python-ideas mailing list