title: Optional argument in lambda function
body: <p>I have a function:</p>
  
  <pre><code>cost(X, model, reg = 1e-3, sparse)
  </code></pre>
  
  <p>And I need to pass this function to another one under the form:</p>
  
  <pre><code>f(X, model)
  f(X, model, reg = reg)
  </code></pre>
  
  <p>I am using lambda to do this:</p>
  
  <pre><code>f = lambda X, model: cost(X, model, sparse = np.random.rand(10,10))
  </code></pre>
  
  <p>And python complains that lambda got an unexpected argument reg. How do I do this correctly?</p>
  
  <p>If I do the other way:</p>
  
  <pre><code>f = lambda X, model, reg: cost(X, model, reg = reg, sparse = np.random.rand(10,10))
  </code></pre>
  
  <p>Then it's not working in the first case.</p>