摘要:
1 装饰器无参数 class tracer: def __init__(self,func): self.calls = 0 self.func = func def __call__(self,*args): self.calls += 1 print('call %s to %s' %(self 阅读全文
posted @ 2017-03-22 15:55
sysnap
阅读(3332)
评论(0)
推荐(0)
摘要:
1 装饰器参数 1.1 装饰器和被装饰函数都不带参数 """ 装饰器装饰一个函数时,究竟发生了什么 """ def decorator_hello(func): print("decorator_hello called") return func @decorator_hello def hell 阅读全文
posted @ 2017-03-22 11:59
sysnap
阅读(166)
评论(0)
推荐(0)

浙公网安备 33010602011771号