[Python-ideas] AST Pretty Printer

Andrew Barnert abarnert at yahoo.com
Fri Sep 13 02:01:46 CEST 2013


On Sep 12, 2013, at 16:31, Ryan <rymg19 at gmail.com> wrote:

> I always encounter one problem when dealing with Python ASTs: When I print it, it looks like Lisp(aka Lots of Irritated Superfluous Parenthesis).

Why are the parentheses irritated? Have you been taunting them? :)

> In short: it's a mess.
> 
> My idea is an AST pretty printer built on ast.NodeVisitor. If anyone finds this interesting, I can probably have a prototype of the class between later today and sometime tomorrow.

Yes please!

I'll bet most people who play with ASTs want this, build something half-assed, never finish it, and lose it by the next time they look at ASTs again three years later... So if you finish something, that'll save effort for hundreds of people in the future (who have no idea they'll want it one day).


More information about the Python-ideas mailing list