On Saturday, March 26, 2011 7:50:36 AM UTC-4, Steven D'Aprano wrote:
>
> That's of the order of 200 MB of memory -- not that much for today's
> systems. I've had people email me .doc files that big *wink*
Yikes! I know this thread is about caching the output of a function, but in the
example of Fibonacci numbers, we're blessed with an easily derived closed form
expression (via Z transform, etc):
def fib(n):
phi = (5 ** 0.5 + 1) / 2
f = (phi ** n - (1 - phi) ** n) / 5 ** 0.5
return int(f)
--
http://mail.python.org/mailman/listinfo/python-list