this is my function Foo:
def Foo(n=10):
if 1<n<=10:
for i in range(1, 10):
#### Do_Something
Foo(n-1)
I get RuntimeError: maximum recursion depth exceeded, which is frustrating since I was expecting Foo’s recursion depth to be 10+, nowhere near python’s default 500 limits.
I know I’ll be getting gigantic amount of stacks with this Foo, but that is bearable. I tried increasing sys.setrecursionlimit and still getting RuntimeError. Any suggestions?
The documentation of
sys.setrecursionlimitspecifies that the recursion limit is actually the depth of the python stack.EDIT I don’t know why you’re hitting the recursion limit, but you’re probably not hitting because of this function (I’ve modified it so that it prints the maximum times it is on the stack):