I have this function f(x, a, b):
def f(x, a, b):
return a*x + b
and I have to pass this function to another one with 'a' and 'b' pre-set, e.g.:
def print2(f):
x = np.linspace(0,1,10)
print(f(x))
print2(f( , 1, 1))
I know that there are other ways to solve this particular problem, however this is just an example, not the real problem, and I'd like to know if there's anyway to do something like this "print2(f( , 1, 1))". In other words, is there anyway to do this without having to pass the arguments all the way through? Like,
def print3(f, a, b):
x = np.linspace(0, 1, 10)
print(f(x, a, b))
print3(f, a, b)