Referring back to this example: > It all fits together beautifully. > > def func(arg, arg) [optimized, classmethod]: > .author = 'Sir Galahad' > .version = 42 > """Description.""" > code > more code These syntax decisions work well together because they make it visually obvious what is going to happen in what order. first do this then this then this | | | v | | .--------------------. v v | def func(arg, arg) | [optimized, classmethod]: | '---------. | .author = 'Sir Galahad' | | .version = 42 | | """Description.""" | | code | | more code | '------------------------------' First, the function is defined with the attributes set in it; then the decorators are applied from left to right. That's good because it lets us set attributes that pass information to decorators, as in Paul's examples: def foo(self) [spark]: .spark_rule = 'DOC := HEAD BODY FOOT' def foo(self) [publish_to_web]: .url = '/cgi-bin/directory/directory' -- ?!ng
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