Unpacking arguments : parameter « Function « Python Tutorial






def func(a, b, c, d): print a, b, c, d
args = (1, 2)
args += (3, 4)
func(*args)


args = {'a': 1, 'b': 2, 'c': 3}
args['d'] = 4
func(**args)

func(*(1, 2), **{'d': 4, 'c': 4})
func(1, *(2, 3), **{'d': 4})
func(1, c=3, *(2,), **{'d': 4})








10.2.parameter
10.2.1.The semantics of argument passing
10.2.2.Pass functions to other functions as arguments
10.2.3.Passing Functions as parameter
10.2.4.Passing and Calling (Built-in) Functions
10.2.5.Positional Arguments
10.2.6.Passing lists and individual list elements to functions.
10.2.7.Simulating Output Parameters
10.2.8.Unpacking arguments