Bengt Richter wrote: > I've also posted sporadic musings about the possibilities for AST-transforming > custom import functions to do optimizations and macros and special forms etc., > but no one seemed much interested (or maybe they quietly went off to do > something of their own ;-)
For an example of AST transformations, take a look at the libxml2macro.py script in the libxml2dom distribution [1]: it contains code which transforms ASTs based on simple rules (changing method calls to function calls) as well as the magic sequence of instructions to generate .pyc files from ASTs. Originally, the analysis distribution [2] also compiled modified ASTs to Python bytecode, but such activities didn't really fit in with the goals of that particular project. Paul [1] http://www.python.org/pypi/libxml2dom [2] http://www.python.org/pypi/analysis -- http://mail.python.org/mailman/listinfo/python-list