Potentially useful code snippets
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

30 lines
444 B

def deco(func):
def wrapper(*args, **kwargs):
func(*args, **kwargs)
wrapper.count+=1
wrapper.count=0
return wrapper
def deco2(func):
def wrapper(*args, **kwargs):
print(args)
def fname(*args):
print('args',args)
return fname
@deco2
def fname(arg):
print(arg)
@deco
def main(arg):
print(arg)
for item in range(3):
main(item)
print('count', main.count)
fname('test')