angrykola

  博客园  :: 首页  :: 新随笔  :: 联系 :: 订阅 订阅  :: 管理

2013年11月23日

摘要: 装饰器简介:@decoratorclass C:pass'''等于'''C = decorator(C)最简单的装饰器函数,写一个计时器import timedef timer(fu): def insfnc(): strat = time.clock() fu() end = time.clock() print('\n',strat,end) print('usetime : %r'%(end-strat)) return insfnc@timer ... 阅读全文
posted @ 2013-11-23 12:36 kolaman 阅读(171) 评论(0) 推荐(0)