装饰器

def makebold(f):
return lambda: "<b>" + f() + "</b>"

def makeitalic(f):
return lambda: "<i>" + f() + "</i>"

@makebold
@makeitalic
def say():
return "Hello"

say()

Hello
不使用装饰器,可读性非常差

def say():
return "Hello"

 makebold(makeitalic(say))()

Hello