Skip to content

Instantly share code, notes, and snippets.

@y56
Created April 30, 2020 06:04
Show Gist options
  • Save y56/d794a25ba832d0e502707d61ecb801a7 to your computer and use it in GitHub Desktop.
Save y56/d794a25ba832d0e502707d61ecb801a7 to your computer and use it in GitHub Desktop.
functools.lru_cache
import functools
@functools.lru_cache(None)
def f(x):
print('f')
return 2
def g(x):
print('g')
return 2
for _ in range(20):
f(3)
for _ in range(20):
g(3)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment