Program calling unwanted functions

Dave Angel davea at davea.name
Mon Dec 22 19:12:01 EST 2014


On 12/22/2014 07:04 PM, sohcahtoa82 at gmail.com wrote:
>>>> def test(t):
> ...     print(t)
> ...     test(t+1)
> ...
>>>> test(1)
> 1
> 2
> 3
> 4
> <snip>
> 998
> 999
> Traceback (most recent call last):
>    File "<stdin>", line 1, in <module>
>    File "<stdin>", line 3, in test
>    File "<stdin>", line 3, in test
>    File "<stdin>", line 3, in test
> <snip>
>    File "<stdin>", line 3, in test
>    File "<stdin>", line 3, in test
> RuntimeError: maximum recursion depth exceeded
>
> Huh...there actually is a limit of about 1,000.  I'm assuming this is hard-coded?  I did a similar test with Java a while back and was getting different results every time.
>

https://docs.python.org/3.4/library/sys.html#sys.getrecursionlimit


-- 
DaveA



More information about the Python-list mailing list