title: RecursionError: maximum recursion depth exceeded in comparison
body: <p>I hope that this is not a duplicate, I apologise if so, but have done some googling and looking around stack overflow and not found anything as yet...</p>
  
  <p><strong>MCVE</strong></p>
  
  <p>I understand that if a function keeps calling itself, this can't keep happening indefinitely without a stack overflow, and so an error is raised after a certain limit. For example:</p>
  
  <pre><code>def foo():
      return foo()
  
  foo()
  </code></pre>
  
  <p>This gives rise to the following error:</p>
  
  <pre><code>RecursionError: maximum recursion depth exceeded
  </code></pre>
  
  <p>However, if I write a function such as the following:</p>
  
  <pre><code>def count(n):
      if n == 0:
          return 0
      else:
          return count(n-1)+1
  
  count(1000)
  </code></pre>
  
  <p>I get a slightly different error:</p>
  
  <pre><code>RecursionError: maximum recursion depth exceeded in comparison
  </code></pre>
  
  <p><strong>The question</strong></p>
  
  <p>What is the  "in comparison" referring to in the above error. I guess what I'm asking is what is difference between these two situations, that gives rise to two different errors.</p>