[Tutor] strange recursion result

Tesla Coil tescoil@irtc.net
Mon, 08 Jan 2001 17:07:02 -0600


On 08 Jan 2001, Shelia King replied:
>> Okay, how to determine the limit for your platform
>> without a stress test? (fun tho' that may be...)
>
> From the same page,
> http://www.python.org/doc/current/lib/module-sys.html
>
> getrecursionlimit()

Ah, but see, all that tells you is its current setting...

>>> import sys
>>> now = sys.getrecursionlimit()
>>> print now
1000
>>> sys.setrecursionlimit(999)
>>> now = sys.getrecursionlimit()
>>> print now
999

I wanna know how to figure out the maximum setting
for a specific platform without provoking a crash.

Hmm, sys.setrecursionlimit() might be entertaining
to use in a recursive function <wink>.