Feb-08-2019, 09:39 AM
Does recursion cause any trouble in Python?
Recursion effect
|
Feb-08-2019, 09:39 AM
Does recursion cause any trouble in Python?
Feb-08-2019, 04:14 PM
It can. Python has a limit on the size of the interpreter stack. Very deep recursion can cause an error by exceeding that limit. The limit can be found with sys.getrecursionlimit() and modified with sys.setrecursionlimit(). Note that if you set it too high, that can overflow the underlying C stack size.
Also, while some languages like Erlang can get around the stack limit by using tail recursion, Python is not set up to do that.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness. Recommended Tutorials: BBCode, functions, classes, text adventures |
|