Meta decorator with parameters, defined in explicit functions

Ben Finney ben+python at benfinney.id.au
Sat Jul 2 01:32:12 EDT 2016


Ian Kelly <ian.g.kelly at gmail.com> writes:

> You should use functools.wraps instead of clobbering the decorated
> function's name and docstring:
>
>         @functools.wraps(decorator)
>         def decorate(*args, **kwargs):
>             ...

Thanks. Can you write the full implementation with that, so I can be
sure of where you expect that to go?

-- 
 \      “I knew things were changing when my Fraternity Brothers threw |
  `\           a guy out of the house for mocking me because I'm gay.” |
_o__)                                      —postsecret.com, 2010-01-19 |
Ben Finney




More information about the Python-list mailing list