title: recursively concatenate string in python
body: <p>I have a recursive function that concatenate a string (and do some logic) and when the logic is done, it finish the function and return the result in the variable.</p>
  
  <p>(my function is quite big so I simplified it.</p>
  
  <pre><code>  import random
    def test(str):
        l = len(str)
        if l &gt;= 10:
            return 0
        str += random.choice('abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ')
        test(str)
  
    str = ''
    test(str)
    print str
  </code></pre>
  
  <p>When i "print str" in my function it works, iget:</p>
  
  <pre><code>r
  rV
  rVG
  rVGF
  rVGFK
  rVGFKa
  rVGFKat
  rVGFKatY
  rVGFKatYN
  rVGFKatYNY
  </code></pre>
  
  <p>but when I print str (last line of the code) i get an empty string</p>