摘要: from functools import wraps class logit(): def __init__(self, logfile='out.log'): self.log = logfile def __call__(self, func): @wraps(func) def wrapper(*args... 阅读全文
posted @ 2016-08-26 16:21 弋痕夕的残影 阅读(974) 评论(0) 推荐(0) 编辑
摘要: from functools import wraps def cache(func): data = {} @wraps(func) def wrapper(*args): if args in data: print "in cache" return data[args] else: ... 阅读全文
posted @ 2016-08-26 16:20 弋痕夕的残影 阅读(1055) 评论(0) 推荐(0) 编辑