(fn)
return wrapper
Memorization decorator
Memorization decorator
Memorization decorator
def memo(fn):
    """Memorization decorator"""

    cache = {}
    miss = object()

    @wraps(fn)
    def wrapper(*args, **kwargs):
        result = cache.get(args, miss)
        if result is miss:
            result = fn(*args)
            cache[args] = result
        return result
    return wrapper
def memo ( fn ) : cache = { } miss = object ( ) @ wraps ( fn ) def wrapper ( * args , * * kwargs ) : result = cache . get ( args , miss ) if result is miss : result = fn ( * args ) cache [ args ] = result return result return wrapper