sys.setrecursionlimit
Python doesn't support tail recursion. Hence, it's easy to face RecursionError
when implementing recursive algorithms. You can get and change maximum recursion depth with sys.getrecursionlimit and sys.setrecursionlimit functions:
import sys
sys.getrecursionlimit()
# 3000
sys.setrecursionlimit(4000)
sys.getrecursionlimit()
# 4000
However, it's a dangerous practice, especially because every new frame on the call stack is quite expensive. Luckily, any recursive algorithm can be rewritten with iterations.