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...
MCVE
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:
def foo():
return foo()
foo()
This gives rise to the following error:
RecursionError: maximum recursion depth exceeded
However, if I write a function such as the following:
def count(n):
if n == 0:
return 0
else:
return count(n-1)+1
count(1000)
I get a slightly different error:
RecursionError: maximum recursion depth exceeded in comparison
The question
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.
n==0, and the error message tells us that this is a conditional recursion.n == 0. What's the big deal?