> The new "vertical bar" syntax was proposed recently, and has gotten > almost unanimously positive feedback. In particular, of 17 responses > to the syntax, only one has been negative (see table, below). I want to mention one argument for '@' that doesn't apply to '|': it will be familiar to Java programmers. > I'm including both of the following variants: > > |classmethod > |accepts(int, int) > |returns(float) > def foo(arg1, arg2): > ... > > def foo(arg1, arg2): > |classmethod > |accepts(int, int) > |returns(float) > ... > > (I prefer the second, but would be happy with either.) In the discussion on decorators months ago, solutions involving special syntax inside the block were ruled out early on. Basically, you shouldn't have to peek inside the block to find out important external properties of the function. (Yes, I know that docstrings violate this principle. For the record, it would be better if they were prefix too; and a prefix decorator syntax will let us fix this in the future but introducing a "doc" decorator.) Please add this to the Wiki for me. --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