0 目的
python decorator
1 設(shè)備
HP+windows7
2 步驟
def f(x):
? ? def g():? ?
? ? ? ? x()? ? ?
? ? return g? ?
@f? ? ? ? ? ? ?
def h1():? ? ? ?
? ? print "H1"?
h1()? ? ? ? ? ?
3 原理
h1()
@f
x <- h1
g
python decorator
HP+windows7
def f(x):
? ? def g():? ?
? ? ? ? x()? ? ?
? ? return g? ?
@f? ? ? ? ? ? ?
def h1():? ? ? ?
? ? print "H1"?
h1()? ? ? ? ? ?
h1()
@f
x <- h1
g