Created
November 21, 2012 23:45
-
-
Save andrewsmedina/4128591 to your computer and use it in GitHub Desktop.
lru_cache
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from functools import lru_cache | |
@lru_cache(maxsize=None) | |
def fib(n): | |
if n < 2: | |
return n | |
return fib(n-1) + fib(n-2) | |
fib(100) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment