I've been busting my head for a while now with this.
Given this function:
def foo(param1, param2, param3):
print 'param1 =', param1
print 'param2 =', param2
print 'param3 =', param3
is it possible to do something like this in Python?
string1 = 'param1'
string2 = 'param2'
string3 = 'param3'
foo(string1='val1', string2='val2', string3='val3') # Uber magic
or something like this?
params = {
'param1': 'val1',
'param2': 'val2',
'param3': 'val3'
}
foo(params) # Even ubener magic
The result of all the magic should be the equivalent to calling
foo(param1='val1', param2='val2', param3='val3')
I'm not interested in changing the function to support **kwargs
by the way.
Thanks in advance!