ClearCode

Decorator and function arguments

May 5th, 2022
796
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.25 KB | None | 0 0
  1. def decorator(func):
  2.     def wrapper(*args,**kwargs):
  3.         print('decoration begins')
  4.         func(*args,**kwargs)
  5.         print('decoration ends')
  6.     return wrapper
  7.  
  8. @decorator
  9. def func(func_parameter):
  10.     print(func_parameter)
  11. #func = decorator(func)
  12.  
  13. func('something')
Advertisement
Add Comment
Please, Sign In to add comment