wraps decorator

The python decorator and wraps Detailed please refer  https://www.cnblogs.com/slysky/p/9777424.html

Python decorators (decorator) in the realization of the function after being decorated in fact already is another function of (name of the function and other functions attributes will change), in order not to affect, Python's functools package provides a decorator called wraps of to eliminate such side effects. Write a decorator, it is best to achieve plus functools before the wrap, it retains the original name and docstring function.

wrapsThe role of decorator, is to  be modified function (wrapped)  some property values assigned to the  decorator function (wrapper)  shows that eventually the property more in line with our intuition.

Guess you like

Origin www.cnblogs.com/yafeng666/p/12190040.html