Skip to content

Latest commit

 

History

History
11 lines (8 loc) · 217 Bytes

File metadata and controls

11 lines (8 loc) · 217 Bytes

functools cache

@functools.cache provides unlimited memoization. Use @lru_cache(maxsize=N) for bounded cache.

@cache
def fib(n):
    return n if n < 2 else fib(n-1) + fib(n-2)

Learned on 2025-04-23