[Tutor] maximum recursion depth exceeded !

Ewald Ertl ewald.ertl at hartter.com
Thu Jul 7 12:58:34 CEST 2005


Hi Mohammad!

I've never use a recursive function in python, but the error has the 
same meaning as e.g in java. 

Your function get's called and called without the end-criteria for the 
recursive call is ever met. 
I would suggest to check if the end-criteria of the recursive call is 
correct. 

I don't know if there is something like a "default" value for the maximum of 
a recursive call depth.

I just looked into the sys-Module and found the following on my Solaris 9 box:

>>> 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.

>>> sys.getrecursionlimit()
1000
>>> 


HTH Ewald 

on Thu, 7 Jul 2005 14:54:16 +0430  Mohammad Moghimi <m.moghimi at gmail.com> wrote :
---------------------------------------------------------------------------------------------

Mohammad Moghimi > Hi there
Mohammad Moghimi > I wrote a recursive function a got this error how can I increase 
Mohammad Moghimi > maximum recursion depth. And what is its default value?
Mohammad Moghimi > -- Mohammad
Mohammad Moghimi > do you Python?!!
Mohammad Moghimi > _______________________________________________
Mohammad Moghimi > Tutor maillist  -  Tutor at python.org
Mohammad Moghimi > http://mail.python.org/mailman/listinfo/tutor
Mohammad Moghimi > 


------------------- end ----------------------


-- 
Ing. Ewald Ertl         HartterGruppe                   Phone : +43-3352-33085-558
trinomic Projektmanagement & Informationstechnik GmbH   Fax   : +43-3352-33085-600
Wiener Straße 41                                        mailto:ewald.ertl at trinomic.com
A-7400 Oberwart         http://www.trinomic.com         mailto:ewald.ertl at hartter.com



More information about the Tutor mailing list