What's the maximum level of recursion and how do I change it in Python?
-
33see stackoverflow.com/questions/3289430/python-recursionRYFN– RYFN2010-07-20 11:32:44 +00:00Commented Jul 20, 2010 at 11:32
-
4lol!! loving it! Just like google.co.uk/search?hl=en&q=recursionLizard– Lizard2010-07-20 11:34:38 +00:00Commented Jul 20, 2010 at 11:34
-
6@Zeus, I tried to close this as a duplicate of itself. Too bad it didn't work.senderle– senderle2012-07-14 18:48:06 +00:00Commented Jul 14, 2012 at 18:48
Add a comment
|
2 Answers
Thought I will add a code example:
import sys
sys.setrecursionlimit(100000)
As Lizard noted, default is 1000 for a reason and the warning is important. Trying a high recursion limit on fibonacci(10000) ( return f(n-1) + f(n-2) ) was enough to shut down my Python IDE. Not getting the 'recursion depth reached' warning did not mean the problem was solved.