Re:Understanding Python bytecode by implementing tail call o...
by mynameisfiber on Friday April 24, 2015 @10:27AM
(#9433507)
No, but the time complexity is the same.
[ Parent
| on HN ]
Re:Understanding Python bytecode by implementing tail call o...
by hughdbrown on Monday April 27, 2015 @11:19PM
(#9450409)
Okay but if you are going to call the function factorial, why not have it actually calculate a factorial? This would have done the job:
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.