Understanding Python bytecode by implementing tail call optimization(blog.fastforwardlabs.com) |
Understanding Python bytecode by implementing tail call optimization(blog.fastforwardlabs.com) |
def factorial(N, result=1):
if N == 1:
return 1
return factorial(N-1, N*result) def factorial(N, result=1):
if N == 1:
return result
return factorial(N-1, N*result)
Assuming that you never call it with the result argument.As written, it just looks like the author never ran the code.