What is the maximum recursion depth, and how to increase it?
It is a guard against a stack overflow, yes. Python (or rather, the CPython implementation) doesn’t optimize tail recursion, and unbridled recursion causes stack overflows. You can check the recursion limit with sys.getrecursionlimit: import sys print(sys.getrecursionlimit()) and change the recursion limit with sys.setrecursionlimit: sys.setrecursionlimit(1500) but doing so is dangerous — the standard limit is a … Read more