New tail recursion decorator

Casey Hawthorne caseyhHAMMER_TIME at
Fri May 12 16:31:06 EDT 2006

Your examples are not tail recursive because an extra step is needed
before returning from the function call and that step cannot be thrown

Alexander Schmolck <a.schmolck at> wrote:

>def even(n):
>    return n == 0 or not odd(n-1)
>def odd(n):
>    return n == 1 or not even(n-1)


More information about the Python-list mailing list