|
|
|
|
|
by vessenes
5367 days ago
|
|
Is there a reason that these examples are using some sort of deeply nested call stack? Is it just to enforce 'slowness' in the function calls? def fibonacci(n):
a,b = 0,1
for i in range(0,n):
a,b, = b,a+b
return b
(cadged from zacharyfox.com) performs far, far better than the nested function calls. I imagine it would in javascript as well. In python at least, all that function calling infrastructure is relatively expensive. |
|