On Sunday, July 3, 2016 at 4:49:15 PM UTC+12, Ian wrote: > > On Sat, Jul 2, 2016 at 12:40 AM, Lawrence D’Oliveiro 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'
That is a function that I am generating, so naturally I want to give it a useful docstring. Am I “clobbering” any objects passed in by the caller, or returned by the caller? No, I am not. -- https://mail.python.org/mailman/listinfo/python-list