from functools import wraps
def a():
a='aa'
def b():
b="bbb"
c=wraps(a)(b)
print c#what happen?
What is the wraps mean, example is the best.
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Quoted from the documentation:
This is a convenience function for invoking
partial(update_wrapper, wrapped=wrapped, assigned=assigned, updated=updated)as a function decorator when defining a wrapper function. For example:Without the use of this decorator factory, the name of the example function would have been ‘wrapper’, and the docstring of the original example() would have been lost.