New tail recursion decorator
Tim N. van der Leeuw
tim.leeuwvander at nl.unisys.com
Fri May 12 10:25:31 EDT 2006
Duncan Booth wrote:
> Tim N. van der Leeuw wrote:
>
[...]
> @tail_recursion
> def factorial2(n):
> # do the stuff
> pass
>
> your 'do the stuff' actually had an erroneous call to 'factorial'. If you
> are going to rename the function you have to rename the recursive calls as
> well. (At least, that's what I forgot to do when I first tried it and
> couldn't understand why it gave me an answer instead of crashing.)
[...]
Duncan,
You're totally right. Somehow, I had managed to completely overlook
this. Oops!
My apologies! :)
--Tim
More information about the Python-list
mailing list