python decorators

it's a syntatical sugar:

@function1

def function2:
    do something

equal to:

function2 = function1(function2)

so the return type of function1 must be a callable:

def function2(f):
    return lambda: start() + f() + end()

Aspect-oriented programing

posted @ 2017-03-10 16:50  HEIS老妖  阅读(92)  评论(0编辑  收藏  举报