decorator

Estimated reading time: 1 minute

decorator

  • @decorator
def decor(t):
  return t

def posts():
  print("this is a post")

result = decor(posts)
def decor(t):
  print("yoyo")
  return t

@decor
def posts():
  print("this is a post")
posts()
# yoyo
# this is a post
python