Python Countdown

Micah Elliott mde at micah.elliott.name
Fri Nov 11 21:14:29 CET 2005


On Nov 11, john boy wrote:
>    I am running the following program from the example in "how to
>    think like a computer scientist"
>    ...
>    When I set "n"= 1000 the program runs in interpreter and stops
>    counting down at 14 instead of running all the way to "Blastoff".
>    Why  is this program only counting to 986....Anybody have an
>    answer??

Did you notice the error:

    ...
    RuntimeError: maximum recursion depth exceeded

You can't recurse forever!

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

You can set it a little higher (sys.setrecursionlimit) if you want to
make this particular example work, but you'll see many disclaimers on
doing this.

-- 
_ _     ___
|V|icah |- lliott  http://micah.elliott.name  mde at micah.elliott.name
" "     """



More information about the Python-list mailing list