I'm trying to use the function partial from module functools on a callable which has an argument which is a function. I've come up with a minimalist sample code.
from functools import partial
def g(f, x):
return f(x)
def cube(x):
return x*x*x
p1 = partial(g, x=3)
abc = p1(cube) # works
p2 = partial( g, f=cube)
abc = p2(3) # fails TypeError: g() got multiple values for keyword argument 'f'
Can the function work with that case?
Thanks