[Python-ideas] AST Pretty Printer

Paul Tagliamonte paultag at debian.org
Fri Sep 13 04:44:14 CEST 2013

On Thu, Sep 12, 2013 at 06:31:08PM -0500, Ryan 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). In
>    short: it's a mess.

Bwahah; well, to each their own.

As some might remember from PyCon this year[1], I actually wrote a lisp
front-end (OK, not *really* lisp) to Python AST. Works pretty well (even
smoothed out the 2.x and 3.x differences, so most code is valid between
the two)


Yes, it's hilarious. No, parens aren't ugly :)

>    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.

I'd enjoy such a thing!

[1]: http://pyvideo.org/video/1853/friday-evening-lightning-talks

 .''`.  Paul Tagliamonte <paultag at debian.org>
: :'  : Proud Debian Developer
`. `'`  4096R / 8F04 9AD8 2C92 066C 7352  D28A 7B58 5B30 807C 2A87
 `-     http://people.debian.org/~paultag
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: Digital signature
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20130912/d7add3df/attachment.sig>

More information about the Python-ideas mailing list