Neil Schemenauer wrote: > On Tue, Aug 24, 2004 at 11:56:13AM -0700, montanaro at users.sourceforge.net wrote: > >>Modified Files: >> pep-0318.txt >>Log Message: >>List some possible reasons why arriving at consensus about >>decorators has been so hard (or impossible) to acheive. There are >>certainly more. > > > Perhaps you could add my reservation (objection is too strong a > word). I think decorators are not powerful enough given their high > syntactic profile. This could be rephrased as "if we are going the > use the @ sign then it should be able to do really cool things". > > One idea is to have the compiler pass the AST for the function body > to the decorator function. The decorator could create new nodes in > the AST or modify existing ones. That would allow decorators to do > things like adding a try/except without introducing another function > call. The output of the decorator would be passed to the code > generator. > That kind of stuff is my dream use of the AST; modifying it before final compilation to a .pyc file. Although that could also just be set up in a list that gets called on *all* compilations. We could also just keep the AST around in the code object, although that would be space-consuming. -Brett
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