Despite some positive responses, my proposal (which was originally due to Jim Hugunin, who probably has more C# experience than all of us arguing together) is getting some tough opposition. I'd like to have a bake-off, where we view a serious amount of code using decorators to the hilt with each of three proposed syntaxes: 1) Last-before-colon: def foo(cls, arg1, arg2) [funcattrs(foo=42), deprecated, overrides, classmethod]: pass 2) Prefix list: [funcattrs(foo=42), deprecated, overrides, classmethod] def foo(cls, arg1, arg2): pass 2a) Prefix list with leading *: *[funcattrs(foo=42), deprecated, overrides, classmethod] def foo(cls, arg1, arg2): pass 3) Prefix suite (could use a different keyword than 'decorate'): decorate: funcattrs(foo=42) deprecated overrides classmethod def foo(cls, arg1, arg2): pass None of the other positions between def and arglist are acceptable any more; a keyword after the argument list isn't acceptable; I don't think any syntax that puts the decorators inside the body (between the colon and the docstring) will work. So this is the field. What I'm asking (especially of Phillip) is to collect a set of realistic method declarations using decorators; we can then collectively format these using any of the possible syntaxes, and see how they look. We can also review different ways of spreading multiple decorators across several lines, e.g. [funcattrs(foo=42), deprecated, overrides, classmethod] def foo(cls, arg1, arg2): pass --Guido van Rossum (home page: http://www.python.org/~guido/)
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4