from functools
import wraps;
def log(
text)
:
def dec(
func)
:
@wraps(func)
def wrap(
*args,**kw)
:
print(
'call :',text
,func.
__name__)
return func(
*args,**kw)
return wrap
return dec
@log(
'测试')
def new()
:
print(
'new')
new()
转载请注明原文地址: https://www.6miu.com/read-63829.html