[Python-ideas] Problems (and solutions?) in writing decorators

Jonathan Fine jfine2358 at gmail.com
Thu Oct 25 12:28:24 EDT 2018


Was: Return for assignment blocks

Anders Hovmöller wrote:

> Personally I often just copy paste an existing decorator and then tweak it instead of writing from scratch because it's too confusing and error prone to do that.

Thank you, Anders, for your honesty. I also find writing decorators a
bit hard. It seems to be something I have to learn anew each time I do
it. Particularly for the pattern

@deco(arg1, arg2)
def fn(arg3, arg4):
    # function body

Perhaps doing something with partial might help here. Anyone here
interested in exploring this?

-- 
Jonathan


More information about the Python-ideas mailing list