Skip to content

Instantly share code, notes, and snippets.

@andrewsmedina
Created November 21, 2012 23:45
Show Gist options
  • Save andrewsmedina/4128591 to your computer and use it in GitHub Desktop.
Save andrewsmedina/4128591 to your computer and use it in GitHub Desktop.
lru_cache
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