Re: [Tutor] help with a recursive function

2011-09-27 Thread Alan Gauld
On 27/09/11 19:32, c smith wrote: i understand the general idea of recursion and if I am following well written code I can understand how it works, but when I try to write it for myself I get a bit confused with the flow. Others have dealt with the specifics. If you really want to learn how to

Re: [Tutor] help with a recursive function

2011-09-27 Thread Steven D'Aprano
Mac Ryan wrote: raise BaseException('Something is wrong here!') Never raise BaseException directly! BaseException is the very top of the exception hierarchy, you should raise the *most* specific exception you can, not the least specific. BaseException isn't even just for errors, it's al

Re: [Tutor] help with a recursive function

2011-09-27 Thread Steven D'Aprano
c smith wrote: hi list, i understand the general idea of recursion and if I am following well written code I can understand how it works, but when I try to write it for myself I get a bit confused with the flow. Your flow is fine. You just forget to return anything in two of the three branches

Re: [Tutor] help with a recursive function

2011-09-27 Thread Mac Ryan
On Tue, 27 Sep 2011 14:32:00 -0400 c smith wrote: > hi list, > i understand the general idea of recursion and if I am following well > written code I can understand how it works, but when I try to write > it for myself I get a bit confused with the flow. > I was trying to turn an ackerman functio

[Tutor] help with a recursive function

2011-09-27 Thread c smith
hi list, i understand the general idea of recursion and if I am following well written code I can understand how it works, but when I try to write it for myself I get a bit confused with the flow. I was trying to turn an ackerman function into python code for practice and I tried writing it like th