title: Recursion over one value, but storing lists along the way
body: <p>My question is i have a function as follows:<br/></p>
  
  <pre><code>def myfunc(a):
      b=[]
      b.append(a)
      return myfunc(a-1), b*
  </code></pre>
  
  <p>*= I am aware this will break my function<br/>
  is there any possible way to allow <code>b</code> to update with my used <code>a</code> values while having my function continue running? The code to which the question pertains is a max val. proble. So i have a list of weights and values, and a max. allowable weight. My function finds the max no problem, but I'd like to see what values i'm using to get there. i.e. w=[1,2,3] v=[4,7,2]
  max weight= 3, max val is = 11. What I'd like my function to display in edition are list such as weights used=[1,2] and values used=[4,7]. Sorry for the lack of actual code posted, the site is not allowing it.</p>