Compute a chain of functions in python

后端 未结 1 1411
一整个雨季
一整个雨季 2021-02-13 11:24

I want to get the result of a chain of computations from an initial value. I\'m actually using the following code:

def function_composition(function_list, origin         


        
相关标签:
1条回答
  • 2021-02-13 12:05

    Fold while calling.

    destination = reduce((lambda x, y: y(x)), function_list, origin)
    
    0 讨论(0)
提交回复
热议问题