2011/9/15 Albert Zeyer <albzey at googlemail.com>: > Hi list, > > I thought it would be nice in Python to allow some sort of meta coding > (which goes far ahead of simple function descriptors). > > The most straight forward way would be to allow operations on the AST. > > I wrote a small patch for CPython 2.7.1 which, for each code object, > adds the related AST of the statement to a new attribute `co_ast`. > > https://github.com/albertz/CPython/commit/2670e621458fd80311fc02897b698ea2a36d494b > > Some simple demonstration of what you can do with this: > > https://github.com/albertz/CPython/blob/astcompile_patch/test_co_ast.py > > I'm not sure wether the Python AST in this form is optimal for doing > such things, though. Maybe another representation would be more > efficient and result in simpler code for doing transformations. It would be useful, but is a waste of memory is 99.99% of programs. -- Regards, Benjamin
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