Meta decorator with parameters, defined in explicit functions

Chris Angelico rosuav at gmail.com
Sun Jul 3 20:06:06 EDT 2016


On Mon, Jul 4, 2016 at 9:59 AM, Lawrence D’Oliveiro
<lawrencedo99 at gmail.com> wrote:
>     #begin try_func
>         result.__name__ = func.__name__
>         result.__doc__ = func.__doc__
>         return \
>             result
>     #end try_func

This is the bit we're talking about. You're doing manually what
functools.wraps does for you (and it does other stuff too, to make
help() more useful), and you weren't doing this before.

Your original docstring on result() is completely ignored.

ChrisA



More information about the Python-list mailing list