You have two choices to create higher-order functions: you can use nested scopes or you can use callable objects. For example, suppose you wanted to define line(a,b) which returns a function f(x) that computes the value a*x+b.
Using nested scopes:
def line(a, b):
def result(x):
return a * x + b
return result
Or using a callable object:
class line:
def __init__(self, a, b):
self.a, self.b = a, b
def __call__(self, x):
return self.a * x + self.b
In both cases,
taxes = line(0.3, 2)