from functools import reduce

def compose(*functions):

    def inner(v):
        return reduce(lambda x, y: y(x), reversed(functions), v)
return inner
print(compose(f, g)(5))
RecursionError при составлении лямбда-выражений