from functools import reduce
def comp(f, g):
    return lambda x: f(g(x))

def compose(*fs):
    return reduce(comp, fs, id)
print(compose(lambda x: x + 1, lambda x: x * 3, lambda x: x - 1)(10))
Apply a list of Python functions in order elegantly