expanding dictionary to function arguments
Bruno Desthuilliers
bdesth.quelquechose at free.quelquepart.fr
Tue Nov 1 21:17:41 EST 2005
Noah a écrit :
> I have a dictionary that I would like to expand to satisfy a
> function's agument list. I can used the ** syntax to pass a dictionary,
> but
> this only works if each key in the dictionary matches an argument.
> I cannot pass a dictionary that has more keys than the function has
> arguments.
If you have control over the API functions declarations, makes them so:
def my_api_func(arg1='', arg2='whatever', **kwargs):
code_here
More information about the Python-list
mailing list