Is there a use for combining **kwargs and keyword arguments in a method signature?
>>> def f(arg, kw=[123], *args, **kwargs):
... print arg
... print kw
... print args
... print kwargs
...
>>> f(5, 'a', 'b', 'c', kw=['abc'], kw2='def')
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
TypeError: f() got multiple values for keyword argument 'kw'
It seems useless, but maybe someone has found a nice trick for it…
You’re assigning kw twice.
In this call
f(5, 'a', 'b', 'c', kw=['abc'], kw2='def'), arg=5, kw=’a’, *args = (‘b’,’c’), and then you’re trying to assign kw again.