from functools import wrapsdef wrapper(func): @wraps(func) def inner(request,*args,**kwargs): """ inner的注释: :param request: :param args: :param kwargs: :return: """ print("before") ret = func(request,*args,**kwargs) return ret return inner @wrapperdef f1(request): """ f1的注释信息 :param request: :return: """ print("f1") @wrapperdef f2(request): print("f2")print(f1.__name__)print(f1.__doc__)print(f2.__name__)f1(1)f2(2)
原文地址:https://www.cnblogs.com/zhang-da/p/12079983.html
时间: 2024-11-11 14:32:47