title: Understanding basic recursion using Python
body: <p>I'm having trouble visualizing what actually happens in a recursive function. I've tried drawing activation frames and following the flow of data, but I get lost along the way. The visualizer at PythonTutor.com doesn't help as much as I'd hoped.</p>
  
  <p>Here's a function that determines the number of digits in a number using recursion. </p>
  
  <pre><code>def digits(x):
      if x &gt; 0:
          return 1 + digits(x // 10)
      else:
          return 0
  </code></pre>
  
  <p>Why is the 1 the only things that "survives" from one activation frame to another?</p>