On this page
article
Tip #110: Use lru_cache for expensive pure functions
Python tip #110: Use lru_cache for expensive pure functions.
Tip
Use lru_cache for expensive pure functions
Why
Following this practice makes your Python code more readable, maintainable, and less error-prone.
Example
# Before (avoid)
# ... less idiomatic approach ...
# After (prefer)
# ... idiomatic Python 3.10+ approach ...