What is functools.lru_cache?
Model answer
A decorator that caches function results by arguments, so repeated calls with the same arguments return instantly. Arguments must be hashable. Set maxsize to limit memory. It suits pure functions such as recursive calculations.
Learn this topic
The Python Standard Library: Dates, Counter, Statistics and More in the course Python for Beginners: Learn to Code with Real Projects.
Sign in to add your own answer.