Loading

decorator_example.py

  1. def deco(func):
  2.     def wrapper():
  3.         # do something before
  4.         print("Hey")
  5.         # call the func
  6.         func()
  7.         # do something after
  8.         print("what's up?")
  9.     return wrapper
  10.  
  11. @deco
  12. def myfunc():
  13.     print("babe")