delay and force in Python

Bengt Richter bokr at oz.net
Thu Jan 20 02:53:25 EST 2005


On Wed, 19 Jan 2005 23:53:28 +1000, Nick Coghlan <ncoghlan at iinet.net.au> wrote:
[...]
>> Something else: this crashes with a "maximum recursion reached"
>> . print stream_enumerate_interval(1,998)
>> 
>> while this does not crash
>> . print stream_enumerate_interval(1,900)
>> this means Python has a maximum of something like 900
>> recursions?
>
>The CPython implementation is limited by the stack size allocated by the C 
>runtime library. The exact recursion limit is platform dependent, but something 
>around 1000 sounds fairly normal.
>
ISTM you forgot something ;-)
(I.e., that 1000 is only a default value (don't know if same on all platforms)).

 >>> import sys
 >>> help(sys.setrecursionlimit)
 Help on built-in function setrecursionlimit in module sys:

 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