Meta decorator with parameters, defined in explicit functions
Ian Kelly
ian.g.kelly at gmail.com
Sun Jul 3 00:48:11 EDT 2016
On Sat, Jul 2, 2016 at 12:40 AM, Lawrence D’Oliveiro
<lawrencedo99 at gmail.com> wrote:
> On Saturday, July 2, 2016 at 5:10:06 PM UTC+12, Ian wrote:
>> You should use functools.wraps instead of clobbering the decorated
>> function's name and docstring:
>
> Where am I doing that?
Using the implementation you posted:
>>> @decorator_with_args
... def my_decorator(func, *args, **kwargs):
... """Returns func unmodified."""
... return func
...
>>> my_decorator.__doc__
'generates a decorator which applies my_decorator to the given arguments'
More information about the Python-list
mailing list