📅  最后修改于: 2022-03-11 14:57:12.880000             🧑  作者: Mango
def memoize(func):
cache = dict()
def memoized_func(*args):
if args in cache:
return cache[args]
result = func(*args)
cache[args] = result
return result
return memoized_func