Created
April 30, 2020 06:04
-
-
Save y56/d794a25ba832d0e502707d61ecb801a7 to your computer and use it in GitHub Desktop.
functools.lru_cache
This file contains hidden or 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
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