How safe is recursion in Python? -


i'm working on ai homework, , despite professor's suggestions, have no intention of writing assignment in lisp. however, do want write recursively, better keep concise , simple. here question:

am running major risk of running out of stack space if perform search on large state space? how deep python stack go?

how deep python stack go?

the default recursion limit in python 1000 frames. can use sys.setrecursionlimit(n) change @ own risk.

if you're set on using python, suggest using pattern more suited language. if want use recursive style search, , need arbitrary stack depth, can make use of python's enhanced generators (coroutines) create "trampoline pattern" (there example in pep342)

and despite professor's suggestions, have no intention of writing assignment in lisp

if exercise intended recursion-based, tail-call optimized language, lisp, best bet.


Comments

Popular posts from this blog

apache - Add omitted ? to URLs -

redirect - bbPress Forum - rewrite to wwww.mysite prohibits login -

php - How can I stop spam on my custom forum/blog? -