maximum recursion depth

Paul phsdv.remove at earthlink.net
Sun Jul 21 02:00:17 EDT 2002


Thanks Kalle and Peter.

I've added: sys.setrecursionlimit(3000)
and my application is doing what I want it to do :-) (2200 recursions...)
Now I can start optimizing my code.

Paul

"Peter Hansen" <peter at engcorp.com> wrote in message
news:3D3A42C6.EB9EA9A at engcorp.com...
> 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