title: How to bind a lambda inside another lambda?
body: <p>I'd like to construct filters depending on certain parameters, by chaining together python lambdas like this:</p>
  <pre><code>filter_even = True
  my_filter = lambda x: x # Base filter
  if filter_even:
      my_filter = lambda x: my_filter(x) and x % 2 == 0
  list(filter(my_filter, [1,2,3,4]))
  </code></pre>
  <p>But <code>my_filter</code> is not bound in the lambda, but a reference to the new lambda, so I get</p>
  <pre><code>RecursionError: maximum recursion depth exceeded
  </code></pre>
  <p>What is the best way to bind the old lambda inside the new one? I thought lambdas behave like variables, but in this case it seems to reference the old lambda by name instead of the content of the variable (which is replaced with the new lambda afterward)</p>