Quick Answer
functools module for higher-order functions. lru_cache (Least Recently Used) memoizes a function - caches results keyed by arguments. @lru_cache(maxsize=128) or @cache (Python 3.9, unlimited). Perfect for recursive algorithms (fibonacci) or expensive computations called repeatedly with same inputs. partial() creates new function with pre-filled arguments. reduce() applies function cumulatively.
Answer
functools offers higher-order tools. lru_cache caches results of expensive functions. Improves performance for recursive or repeated calculations.
S
SugharaIQ Editorial Team
Verified Answer
This answer has been peer-reviewed by industry experts holding senior engineering roles to ensure technical accuracy and relevance for modern interview standards.