infinite recursion

Bengt Richter bokr at oz.net
Tue Nov 19 11:34:59 EST 2002


On 19 Nov 2002 01:17:47 +0000, michael eng <newsread at seabass.yi.org> wrote:

>
>Hello
>
>My program has a deeply recursive function which hits some upper bound
>in Python 2.2.1.  I fear such madness comes from being forced to
>program in Prolog.
>
>Anyway, is there a way in which I can remove the upper bound, such that
>the recursion depth is only limited by the constraints of the machine?
>
>All the documentation I have found tells me how to set it to an
>arbitrary finite value.
>
 >>> import sys
 >>> help(sys.setrecursionlimit)
 Help on built-in function setrecursionlimit:

 setrecursionlimit(...)
     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.

Regards,
Bengt Richter



More information about the Python-list mailing list