>> List some possible reasons why arriving at consensus about decorators >> has been so hard (or impossible) to acheive. There are certainly >> more. Neil> Perhaps you could add my reservation (objection is too strong a Neil> word). I think decorators are not powerful enough given their Neil> high syntactic profile. This could be rephrased as "if we are Neil> going the use the @ sign then it should be able to do really cool Neil> things". I was trying to elaborate general barriers to concluding this process, not issues related to selecting one proposal over another. Neil> One idea is to have the compiler pass the AST for the function Neil> body to the decorator function. The decorator could create new Neil> nodes in the AST or modify existing ones. That would allow Neil> decorators to do things like adding a try/except without Neil> introducing another function call. The output of the decorator Neil> would be passed to the code generator. I suppose you could do that, although if you did I suspect metaclasses would seem tame by comparison. Couldn't you do something like this? @ast_to_func @neils_cool_ast_transform @func_to_ast def f(a): pass After all, there's no restriction on what a decorator can return. How about we save true AST decorators for "$"? <wink> 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