Let's say that I have a two-dimensional function f (x, y) and another function G (function), which takes the function as input. BUT, G takes only one-dimensional functions as input, and I want to pass f to G with the second variable as a fixed parameter.
Now I just declare the third function h, which sets y to the given value. Here's how it looks in one form or another:
def f(x,y):
something something something
return z;
def G(f):
something something something
def h(x):
c= something
return f(x,c);
G(h)
At some point, I also made y the default parameter, which I would change every time.
None of them read as if I could call
G(f(x,c))
this particular syntax does not work. What is the best way to do this?
source
share