Bernhard> Has somebody suggested the following yet? Bernhard> def [classmethod] foo(cls, blooh, bla): Bernhard> pass Yeah, I believe it's come up. Bernhard> Putting the decorators between the "def" and the function name Bernhard> has some advantages over the proposals I've seen so far: Bernhard> - crucial information about the function and the meaning of Bernhard> the parameters is given very early (this was an argument Bernhard> made for putting the decorat before the argument list) I would propose a counterargument. Placing it between the argument list and the colon puts it "close enough" to the "def". I did a quick grep through the Python distribution just now and found 22198 function or method definitions. Of those, 20282 had the name and the entire argument list on the same line as the def keyword. That means in all but a small number of cases decorators would start on the same line as the def keyword. Bernhard> - The name and the argument are together, so it still looks Bernhard> similar to the function invocation (an argument made for Bernhard> putting the decorators after the function list). Yes, but possibly several lines later, making it more difficult to find (you couldn't reliably grep for "^ *def foo" to locate a function definition) and forcing tools like the Emacs tags facility to be rewritten to handle the case where "def" and the function name don't appear on the same line. Skip
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