tail-rec decorator, well still blows the stack...

ssecorp circularfunc at gmail.com
Tue Jul 22 08:15:32 CEST 2008


thanks i already have perfect iterative versions of fibonacci.
def fib(n):
    a, b = 1, 0
    while n:
        a, b, n = b, a+b, n-1
    return b


I know the example is not the way to write pythonic code, I was just
learning about decorators and then I saw this example and tried it
out.

but thanks now i understand why it didn't work.



More information about the Python-list mailing list