python/docs/stdlib/functools

functools

dz / python / docs / stdlib / functools

Node Tree

Nodes

cache
content cache: Simple lightweight unbounded function cache. Sometimes called "memoize".
children leetcode/problems/790_domino_tromino_tiling (caching decorator used in top-down approach)
parents lru_cache, python/docs/stdlib/functools
hyperlink https://docs.python.org/3/library/functools.html#functools.cache
location knowledge/python.dz:402

lru_cache
content Decorator to wrap a function with a memoizing callable that saves up to the maxsize most recent calls. It can save time when an expensive or I/O bound function is periodically called with the same arguments.
children leetcode/problems/1770_max_score_multiplication_operations (used in top-down implementation, used with a size of 2000,because this particular problem has tight time limits), cache (because it never needs to to evict old values, cache is,smaller and faster than lru_cache with a size limit), leetcode/problems/146_LRU_cache (implements an LRU cache)
parents python/docs/stdlib/functools
hyperlink https://docs.python.org/3/library/functools.html#functools.lru_cache
location knowledge/python.dz:408