zhuxianfeng 2020-03-03
class Test(): xx = False def __init__(self): pass def test(func): def wrapper(self, *args, **kwargs): print(self.xx) return func(self, *args, **kwargs) return wrapper @test def test_a(self,a,b): print(f‘ok,{a} {b}‘) if __name__==‘__main__‘: t=Test() t.test_a(‘a‘,‘ab‘)