title: Understanding nested lambda function behaviour in python
body: <p>I'm trying to learn pure functional programming. But this code is puzzling me particularly the second line. I do not understand how the value <code>2</code> is passed to the variable <code>x</code>. Can somebody explain this nested <em><code>lambda</code></em> behaviour?</p>
  
  <pre><code>&gt;&gt;&gt; square_func = lambda x: x**2
  &gt;&gt;&gt; function_product = lambda F, m: lambda x: F(x)*m
  &gt;&gt;&gt; square_func(2)
  4
  &gt;&gt;&gt; function_product(square_func, 3)(2)
  12
  </code></pre>