Modifying Abstract Syntax Trees
I would like to be able to build and modify an ast
and then optionally write it out as python byte code for execution later without overhead.
I have been hacking around with the ast docs for python3.0
and python2.6
, but I can't seem to find any good sources on best practices for this type of code.
Question
What are some best practices and guidelines for modifying abstract syntax trees in python?
[edit]
Unknown states that byteplay is a good example of such a library.
Also, benford cites GeniuSQL which uses abstract syntax trees to transform python code to SQL.