Łukasz Langa <luk...@langa.pl> added the comment: Oh, and Francis, you might actually want to use lib2to3.pytree instead, which will provide you with a Concrete Syntax Tree ("lossless AST"). That tree will keep information like whitespace, comments, and other semantically insignificant tokens like commas and parentheses.
This tree will never modify your input whereas in the AST we might be doing more modifications in the future (like cutting `if` branches that we statically know are always False, and so on). Granted, the lib2to3 tree is a bit awkward to query since the concrete tree exposes the raw Python grammar and not the simplified AST grammar. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue32911> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com