Skip to content

Instantly share code, notes, and snippets.

@hughdbrown
hughdbrown / lru_cache.py
Last active February 27, 2024 17:36
Minimal lru_cache implementation for python 2.7
from functools import wraps
try:
from functools import lru_cache
except ImportError:
def lru_cache(user_function):
cache = {}
@wraps(user_function)
def wrapper(*args):
key = tuple(args)