Keyword argument in unpacking argument list/dict cases in Python
问题 For python, I could use unpacking arguments as follows. def hello(x, *y, **z): print 'x', x print 'y', y print 'z', z hello(1, *[1,2,3], a=1,b=2,c=3) hello(1, *(1,2,3), **{'a':1,'b':2,'c':3}) x = 1 y = (1, 2, 3) z = {'a': 1, 'c': 3, 'b': 2} But, I got an error if I use keyword argument as follows. hello(x=1, *(1,2,3), **{'a':1,'b':2,'c':3}) TypeError: hello() got multiple values for keyword argument 'x' Why is this? 回答1: Regardless of the order in which they are specified, positional