title: Python recursive function definition storage issue
body: <p>I am trying to get a list of functions defined recursively by storing each step of a math serie:
  <code>x^0+x^1+x^2+x^3+...</code> → <code>f0(x)=1, f1(x)=1+x, f2(x)=1+x+x², f3(x)=1+x+x²+x³, ...</code></p>
  <p>I coded this in python:</p>
  <pre class="lang-py prettyprint-override"><code>n = 3
  devs = [lambda x: 1]
  for k in range(n):
      devs.append(lambda x, f=devs[k]: f(x) + x**(k+1))
  print(devs[-1](4))  # x=4
  </code></pre>
  <p>I learned in <a href="https://stackoverflow.com/questions/42357834/defining-functions-recursively-in-python">this answer</a> that you need to pass the previous function as default argument in order to solve the <em>maximum recursion depth</em> error, but this outputs <code>193</code>.<br />
  I think it has to do with the <code>k</code> in the default parameter. It seems to calculate: <code>1+4^3+4^3+4^3=193</code>, or more accurately <code>1+n*x^n</code> instead of <code>x^0+x^1+...+x^n</code></p>
  <p>Can you please tell me what am I doing wrong here?</p>