On Nov 14, 2:24 pm, TK <tok...@web.dewrote:
Hi,
is there a way to change the recursion depth for a function/method?
In Python can I do it:
import sys
sys.setrecursionlimit(1500)
Thanks for help.
o-o
Thomas
No built-in mechanism that I am aware of.
But you could always use an optional parameter as a counter (say
starting at 1500), reduce it within each call, and also check if the
counter reaches zero and exit, or something to that effect. I guess
Python would do something similar. (That's for a specific function,
though, and as I read your example I assume that Python affects all
recursive calls)
My wild imagination assumes there might be some sort of nifty hack
with stack/heap size limit, where you hopefully might get an
std::bad_alloc or so when you reach your recursion limit, but I guess
that would be non-portable.