decorator pattern retaining function __name__ and __doc__ attributes as noted beforeyou ideally do not want any function using your decorator to be changed in any waybut the way we implemented the wrapper function in the previous section caused the __name__ and __doc__ attributes of the function to change to that of the wrapped_f(function look at the output of the following script to see how the __name__ attribute changes func_attrs py def dummy_decorator( )def wrap_f()print("function to be decorated" __name__print("nested wrapping function"wrap_f __name__return (return wrap_f @dummy_decorator def do_nothing()print("inside do_nothing"if __name__ ="__main__"print("wrapped function",do_nothing __name__do_nothing(check the following resultsthe wrapped function took on the name of the wrap function wrapped functionwrap_f function to be decorateddo_nothing nested wrapping functionwrap_f inside do_nothing in order to keep the __name__ and __doc__ attributes of the function being wrappedwe must set them to be equal to the function that was passed in before leaving the scope of the decorator function