Python AST -> source code

John J. Lee jjl at pobox.com
Sat Jul 17 09:26:22 EDT 2004


dpgkru at email.com (Ricardo Santos) writes:

> I have a Python AST, which I have modified slightly (but still a valid
> Python AST). How do I go back to its source code representation?
> 
> source code -> AST   (POSSIBLE)
> AST -> source code   (????????)
> 
> Can someone point me to an open source solution? I don't want to have
> to implement a "pretty printing" AST visitor myself.

I know there's currently an AST branch of Python, containing
widely-spread changes throughout the core Python code.  What the goal
of these changes are, though, I don't know.  Google tells me the
changes are still pre-alpha, which is why they still haven't been
merged into CVS HEAD.

Maybe it's relevant, I don't know...


John



More information about the Python-list mailing list