Python function with **kwargs Question

Duncan Booth duncan.booth at invalid.invalid
Fri Jan 6 03:56:52 EST 2006


Eric McGraw wrote:

> You could call it like this:
>>>> foo(**{"a-special-keyword":5})
> but that might defeat the purpose of keyword arguments.
> 
Don't forget you can mix ordinary keyword arguments with the ** call, so 
only the weird arguments actually need to be passed that way.

>>> def f(**args):
	print args

	
>>> f(a=1, **{'x-y':3})
{'a': 1, 'x-y': 3}
>>> 




More information about the Python-list mailing list