python的decorator
下面这段小代码,展示了decorator的基本功能,详细的讲解google:python decorator...
def abc(fun): def myfun(): print "abc" fun() return myfun @abc def test(): print "test" print test test()
<function myfun at 0xb7598a74>
abc
test
:)
转载请注明出处
下面这段小代码,展示了decorator的基本功能,详细的讲解google:python decorator...
def abc(fun): def myfun(): print "abc" fun() return myfun @abc def test(): print "test" print test test()
<function myfun at 0xb7598a74>
abc
test
:)