Author vstinner
Recipients Mark.Shannon, benjamin.peterson, flherne, georg.brandl, inada.naoki, lukasz.langa, ned.deily, rhettinger, serhiy.storchaka, vstinner
Date 2018-05-24.01:32:55
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527125576.15.0.682650639539.issue32911@psf.upfronthosting.co.za>
In-reply-to
Content
IMHO Python 3.7 will be simpler to process, since it avoids to check if the first node is a docstring or not.

I agree that it's a backward incompatible, but it has been done on purpose. In fact, there is no warranty about backward compatibility on the genreated AST between Python versions (like 3.6 vs 3.7).

As Lukasz wrote, AST of Python 3.6 already omit a lot of information about formatting, we are far from a 1:1 mapping between code and AST. For example, tools to "unparse" AST breaks the formatting. The Python 'ast' module is just not appropriate for such use case. There are other solutions for that, like lib2to3.

Having a docstring attribute *and* a docstring node seem to be redundant to be, or more like a bug. Redundant data can quickly lead to inconsistencies.

The current trend is more to move the AST away from the original Python source code, to produce better AST, especially in term of performance. That's also why I added the ast.Constant node type ;-) And why many peephole optimizations have been reimplemented at the AST level, rather than on the bytecode level.
History
Date User Action Args
2018-05-24 01:32:56vstinnersetrecipients: + vstinner, georg.brandl, rhettinger, benjamin.peterson, ned.deily, inada.naoki, lukasz.langa, Mark.Shannon, serhiy.storchaka, flherne
2018-05-24 01:32:56vstinnersetmessageid: <1527125576.15.0.682650639539.issue32911@psf.upfronthosting.co.za>
2018-05-24 01:32:56vstinnerlinkissue32911 messages
2018-05-24 01:32:55vstinnercreate