标签:main 装饰器 python self wrap lse als sel def
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‘)
标签:main 装饰器 python self wrap lse als sel def
原文地址:https://www.cnblogs.com/wangbin2188/p/12401944.html