# Why do online compilers/interpreters use different limits for the maximum recursion depth error?

When using two different online Python compilers/interpreters for executing a program (this one, and this one), I found that both sites showed the maximum recursion depth error at $$n = 998$$, whereas the one which I had downloaded from python.org showed the error at $$n = 1024$$. Is there a reason why online compilers/interpreters have lower maximum recursion depth limits?

For example, this recursive function (which displays the first $$n$$ terms in the Fibonacci sequence) shows a recursion error at $$n = 998$$ in an online compiler/interpreter.

def fib_memo(n):
if n in fib_cache:
return fib_cache[n]
if n == 1:
value = 1
elif n == 2:
value = 1
elif n > 2:
value =  fib_memo(n-1) + fib_memo(n-2)
fib_cache[n] = value
return value
fib_cache = {}
print (fib_memo(998))


But it shows a recursion error at $$n = 1024$$ in the Windows Python application.

• The recursion depth is platform dependent. You can't make any assumption on what it will be across platforms. You can read the current limit with sys.getrecursionlimit(), and try to set it with sys.setrecursionlimit(). – Steven Feb 28 at 12:46