Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- calls = {}
- def decorator(func):
- def wrapper():
- if func not in calls:
- calls[func] = 0
- calls[func] += 1
- func()
- return wrapper
- @decorator
- def decorated_func_1():
- print('Some prints there')
- @decorator
- def decorated_func_2():
- print('And some prints there')
- @decorator
- def decorated_func_3():
- print('Сука кто я')
- for each in [decorated_func_1, decorated_func_2, decorated_func_3]:
- each()
- print(calls)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement