例示

def get_name(func):
    def warper(*args,**kwargs):
        print("the function name is {}".format(func.__name__))
        result = func(*args,**kwargs)
        return result    
    return warper

@get_name
def my_name():
    print("hello")

my_name()
posted on 2019-07-10 10:23  liehen2046  阅读(67)  评论(0编辑  收藏  举报