The title seems complicated but the problem itself is easy to describe with an example:
func has another function as a parameter (either my_func1 or my_func2) and I need to provide the parameters to these two function but my_func1 needs three parameters (a,b and c) and my_func2 needs two parameters (a and b). How can I use **kwards in the example? Many thanks!!
def my_func1(a,b,c):
result = a + b + c
return result
def my_func2(a,b):
resultado = a*b
return resultado
def func(function,a,**kwargs):
z = function(a,**kwargs)
return z
test = func(my_func1,3,3 3)
ERROR:
ile "<ipython-input-308-ada7f9588361>", line 1
prueba = func(my_func1,3,3 3)
^
SyntaxError: invalid syntax