What is the difference between functools.lru_cache and functools.cache?
Functions and arguments
Audio flashcard · 0:17Nortren·
What is the difference between functools.lru_cache and functools.cache?
0:17
lru_cache is a decorator that memoizes function results using a least-recently-used cache with a configurable maximum size. functools.cache, added in Python 3.9, is equivalent to lru_cache with no size limit. Both are useful for expensive pure functions where the same arguments often produce the same result.
---
docs.python.org