Is there a way to pass function with arguments that looks clean? For example, if I want pass function h
with particular parameter-values a
b
from ars so that ars1 runs with these particular a
b
, what should I do? I want to do
def h(x, a, b):
return x * a * b
def ars(fcn):
a = 1
b = 2
return ars1(fcn( . , a,b))
def ars1(fcn):
return fcn(1)*fcn(1)
ars(h)
I could do
def h(x, a, b):
return x * a * b
def ars(fcn):
a = 1
b = 2
return ars1(fcn, a, b)
def ars1(fcn, a, b):
return fcn(1, a, b)*fcn(1, a, b)
which achieves the purpose but since a
b
have nothing to do with ars1
, the code looks messy and lacks modularity.