Python-symbolic/python_symb/IndependantTools/programming_tools.py

8 lines
No EOL
186 B
Python

def memoize(f):
cache = {}
def memoized_function(*args):
if args not in cache:
cache[args] = f(*args)
return cache[args]
return memoized_function