Better way to call a chain of functions in python?

Viewed 1020

I have a chain of operations which needs to occur one after the other and each depends on the previous function's output.

Like this:

out1 = function1(initial_input)
out2 = function2(out1)
out3 = function3(out2)
out4 = function4(out3)

and so on about 10 times. It looks a little ugly in the code.

What is the best way to write it? Is there someway to handle it using some functional programming magic? Is there a better way to call and execute this function chain?

4 Answers
Related