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‘)
原文地址:https://www.cnblogs.com/wangbin2188/p/12401944.html
时间: 2024-11-08 07:27:51