Christophe Schlick wrote:
The goal of this post is to propose a new syntax for defining decorators in Python.
Too long, did read it. Here's the summary so others don't have to: "The current syntax for writing decorator functions is cumbersome, has too much boilerplate, and doesn't play well with introspection tools. I've got some great new syntax for writing decorators, but you'll have to wait to find out what it is." You've obviously spent a lot of effort thinking this through, but this shouldn't be a mystery novel where you are trying to keep Who Done It secret until the end of the book. You talk a lot about new decorator syntax, but after reading > 150 lines, I still have no idea what it is, how much work it will require, and how disruptive it will be. That doesn't make me very enthusiastic about the idea. Scientific papers and reports often have an executive summary at the very beginning: one or two paragraphs that summarize the report without all the details. Perhaps you should do the same? As for the rationale given in this post, I'm not convinced there's actually a problem that needs solving. The "problems" you list seem pretty minor to me: e.g. so what if you have to name the inner function? Admittedly, that the function signature is lost when using decorators *is* a pretty annoying gotcha, but surely we don't need new *syntax* to fix that. New *functionality* in functools.wraps perhaps? Oh, one thought that comes to me... decorators are a special case of factory functions. Does your proposed syntax (whatever it is!) treat decorator functions as a special case, or does it apply to general factory functions as well? -- Steven