title: How can I make this Python recursive function return a flat list?
body: <p>Look at this simple function</p>
  
  <pre><code>def prime_factors(n):
      for i in range(2,n):
        if n % i == 0:
          return i, prime_factors(n / i)
      return n
  </code></pre>
  
  <p>Here's the result of <code>prime_factors(120)</code></p>
  
  <pre><code>(2, (2, (2, (3, 5))))
  </code></pre>
  
  <p>Instead of nested tuples, I want it to return one flat tuple or list.</p>
  
  <pre><code>(2, 2, 2, 3, 5)
  </code></pre>
  
  <p>Is there a simple way to do that?</p>