On 11/11/05, john boy <[EMAIL PROTECTED]> wrote:
> I am running the following program from the example in "how to think like a
> computer scientist"
>
> def countdown(n):
>       if n ==0:
>            print "Blastoff!"
>       else:
>           print n
>           countdown (n-1)
>
> countdown (1000)
>
> When I set "n"= 1000 the program runs in interpreter and stops counting down
> at 14 instead of running all the way to "Blastoff".  If I set n = 985 it
> completes the program. If I set n=1200 it runs to 214 and stops.  Why is
> this program only counting to 986....Anybody have an answer??
> I am using Python 2.4.2

Look at this:

import sys
sys.getrecursionlimit()

It's set to 1000 by default. (Are you using IDLE or something? That
would explain where your other 14 levels of stack went.) You can
change it if you want to:

sys.setrecursionlevel(2000)

--
Cheers,
Simon B,
[EMAIL PROTECTED],
http://www.brunningonline.net/simon/blog/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to