4 ms·
> implement manually as a decorator in Python Why don't you just use the functools.lru_cache decorator in the standard library?
by Recursing 8y ago
> implement manually as a decorator in Python
Why don't you just use the functools.lru_cache decorator in the standard library?
- qwerty456127 8y agoIt seems I couldn't find it by googling "python memoization" when I've initially come to the point where memoization has become a necessity for me. I've found some custom solutions and built my own inspired by them but suiting my needs better (e.g. memoize to a database + cache in the memory). I'll take a look at functools.lru_cache and consider migrating to it in the cases where I don't need persistent memoization of big datasets, it's always better to use a standard solution when it's enough, thanks.