Python Countdown
Simon Brunning
simon.brunning at gmail.com
Fri Nov 11 15:09:33 EST 2005
On 11/11/05, john boy <xray_alpha_charlie at yahoo.com> wrote:
> I have adjusted the program to:
>
> import sys.
> sys. getrecursionlimit()
> sys.setrecursionlimit(2000)
> def countdown (n):
> if n ==0:
> print "blastoff"
> else:
> print n
> countdown (n-1)
> countdown (1200)
>
> this acutally works now....
Good!
> is there any way to permanently set the recursion
> level or do I have to type a setrecursionlimit everytime the program will
> likely exceed 1000
Well, you could always always set it in site.py, I suppose, but in
general, I prefer iteration over recursion in Python.
--
Cheers,
Simon B,
simon at brunningonline.net,
http://www.brunningonline.net/simon/blog/
More information about the Python-list
mailing list