Skip to content

Instantly share code, notes, and snippets.

View jasonlvhit's full-sized avatar
💭
I may be slow to respond.

辣椒面 jasonlvhit

💭
I may be slow to respond.
View GitHub Profile
#Python 装饰器
#http://programmingbits.pythonblogs.com/27_programmingbits/archive/50_function_decorators.html
def memoize(f):
cache = {}
def helper(x):
if x not in cache:
cache[x] = f(x)
return cache[x]
return helper