The documentation for lru_cache gives the function definition:
@functools.lru_cache(maxsize=128, typed=False)
Th
On Python 3.8+ you can use @lru_cache without parentheses, so your code snippet will work
Python 3.8.0 (default, Oct 28 2019, 16:14:01)
[GCC 9.2.1 20191008] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import functools
>>> @functools.lru_cache
... def f():
... return 2
...
>>>
This was added on May 26, 2019 in commit b821868e.
On Python 3.7 or below you have to do @lru_cache(). As in, add parentheses after @lru_cache