On Tue, 27 Feb 2018 at 05:38 INADA Naoki <songofaca...@gmail.com> wrote:

> Hi, all.
>
> There is design discussion which is deferred blocker of 3.7.
> https://bugs.python.org/issue32911
>
> ## Background
>
> An year ago, I moved docstring in AST from statements list to field of
> module, class and functions.
> https://bugs.python.org/issue29463
>
> Without this change, AST-level constant folding was complicated because
> "foo" can be docstring but "fo" + "o" can't be docstring.
>
> This simplified some other edge cases.  For example, future import must
> be on top of the module, but docstring can be before it.
> Docstring is very special than other expressions/statement.
>
> Of course, this change was backward incompatible.
> Tools reading/writing docstring via AST will be broken by this change.
> For example, it broke PyFlakes, and PyFlakes solved it already.
>
> https://github.com/PyCQA/pyflakes/pull/273
>
> Since AST doesn't guarantee backward compatibility, we can change
> AST if it's reasonable.
>
> Last week, Mark Shannon reported issue about this backward incompatibility.
> As he said, this change losted lineno and column of docstring from AST.
>
> https://bugs.python.org/issue32911#msg312567
>
>
> ## Design discussion
>
> And as he said, there are three options:
>
> https://bugs.python.org/issue32911#msg312625
>
> > It seems to be that there are three reasonable choices:
> > 1. Revert to 3.6 behaviour, with the addition of `docstring` attribute.
> > 2. Change the docstring attribute to an AST node, possibly by modifying
> the grammar.
> > 3. Do nothing.
>

I'm +1 for #3, +0 for #2, -1 for #1.
_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
https://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to