Tag Archive : 装饰器

/ 装饰器

Python函数装饰器

2015-8-22 23:33:10 | Python | 没有评论

Tempest里用例的测试都会用到装饰器,虽然声称很方便,但我看来还是感觉比较非主流

#!/usr/bin/env python
# coding: utf-8

def decorator(func):
    def subfun():
        print 'subfun()'
        return func
    return subfun

@decorator
def[......]

Read more