3 ms·
re: caching python functions, is it referring to functools.lru_cache maybe?
by sweezyjeezy 3y ago
re: caching python functions, is it referring to functools.lru_cache maybe?
- globular-toast 3y agoAlmost certainly. It's just called `functools.cache` now. It's also known as memoisation and a classic use of higher-level functions (aka decorators).
- bobnamob 3y agoAnd memoisation is a common technique to shift performance (processing -> memory) tradeoffs when doing anything trivially recursive. I don't agree with TFA's take of "Nor does it make any sense to have caching at the function level?"