Last active
December 27, 2015 00:09
-
-
Save ledovsky/7235826 to your computer and use it in GitHub Desktop.
Memorization
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
""" | |
Мемоизация. Не зависит от аргументов. | |
""" | |
def _f(*args, **kwargs): | |
if not hasattr(_f, "_retval"): | |
_f._retval = f(*args, **kwargs) | |
return _f._retval | |
return _f |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment