I want to be able to do something like this:
def calculations(a,b):
def add(a,b):
return a+b
def subtract(a,b):
return a-b
def other_function(calculations,c,d):
return calculations(c,d) + 10
result = other_function(add,10,5)
print(result)
>>> 25
This is just a simplified example but I want to be able to let the function "calculations" do 2 different things without passing this choice as a function parameter.
Then, I would like to use this choice as a function parameter to another function "other_function".
Something similar seems to work when defining "calculations" as a class but this is not what I want to use.
Even though it seems not very practical to define "add" and "subtract" inside another function, this is what I want to do.