maximum recursion depth

Peter Hansen peter at engcorp.com
Sun Jul 21 01:12:38 EDT 2002


Paul wrote:
> 
> My question to you: Is there a way to change the limit of the recursion
> depth?

Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
>>> import sys
>>> dir(sys)
[ ...snippety snip, 'setcheckinterval', 'setprofile', 'setrecursionlimit' ... ]
>>> print sys.setrecursionlimit.__doc__
setrecursionlimit(n)

Set the maximum depth of the Python interpreter stack to n.  This
limit prevents infinite recursion from causing an overflow of the C
stack and crashing Python.  The highest possible limit is platform-
dependent.
>>> sys.setrecursionlimit(2000)
>>>

:-)



More information about the Python-list mailing list