Question #906

Which decorator is applied first?
def make_bold(fn):
    return lambda: "<b>" + fn() + "</b>"

def make_italic(fn):
    return lambda: "<i>" + fn() + "</i>"

@make_bold
@make_italic
def hello():
    return "hello world"

helloHTML = hello()

Decorator are applied from bottom to top. @make_italic will be applied first and @make_bold then. (stackoverflow.com/questions/27342149/decorator-execution-...)


Comment on Disqus:

Question difficulty: ๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต๐Ÿ”ต