[issue42903] optimize lru_cache for functions with no arguments

Eugene Toder report at bugs.python.org
Tue Jan 12 01:12:22 EST 2021


Eugene Toder <eltoder at gmail.com> added the comment:

As you can see in my original post, the difference between @cache (aka @lru_cache(None)) and just @lru_cache() is negligible in this case. The optimization in this PR makes a much bigger difference. At the expense of some lines of code, that's true.

Also, function calls in Python are quite slow, so being faster than a function call is not a high bar.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue42903>
_______________________________________


More information about the Python-bugs-list mailing list