i want to show docstring of my function,
but if i use like this
@cost_time
def func():
"define ...."
blabla
print func.__doc__
it will not show the docstring,just because i use some meta programming tricky,
how can fix this?
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.
Your wrapped function returned from the
cost_timedecorator must have the docstring instead offunc. Therefore, usefunctools.wrapswhich correctly sets__name__and__doc__: