title: Composing functions in python
body: <p>I have an array of functions and I'm trying to produce one function which consists of the composition of the elements in my array.
  My approach is:</p>
  
  <pre><code>def compose(list):
      if len(list) == 1:
          return lambda x:list[0](x)
      list.reverse()
      final=lambda x:x
      for f in list:
          final=lambda x:f(final(x))
      return final
  </code></pre>
  
  <p>This method doesn't seems to be working, help will be appreciated.</p>
  
  <p>(I'm reversing the list because this is the order of composition I want the functions to be)</p>