Instantly share code, notes, and snippets.

Embed
What would you like to do?
def function_name (f):
dict = {}
def inner_function(x):
if x not in dict:
dict[x] = f(x)
return dict[x]
return inner_function
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment