Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- class A:
- def b(self, n):
- def deco(fun):
- def deco_sub(*args, **kwargs):
- print(f'--deco begin with b({n})')
- fun(*args, **kwargs)
- return deco_sub
- return deco
- a0 = A()
- a1 = A()
- a2 = A()
- @a0.b(11)
- def m0(v):
- print(str(m0))
- print(v)
- @a1.b(13)
- def m1(v):
- print(str(m1))
- print(v)
- @a2.b(17)
- def m2(v):
- print(str(m2))
- print(v)
- m0(10)
- m1(11)
- m2(12)
- for i in range(3):
- exec(f'''@a{i}.b(1)
- def m{i}(v):
- print(str(m{i}))
- print(v * 100)
- ''')
- m0(10)
- m1(11)
- m2(12)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement