Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

python wrapper function

def memoize(func):
cache = {}
def wrapper(*args):
    if args in cache:
        return cache[args]
    else:
        cache[args] = func(*args)
        return cache[args]
return wrapper
Source by github.com #
 
PREVIOUS NEXT
Tagged: #python #wrapper #function
ADD COMMENT
Topic
Name
4+5 =