[issue32911] Doc strings no longer stored in body of AST

Matthias Bussonnier report at bugs.python.org
Fri May 25 16:59:50 EDT 2018


Matthias Bussonnier <bussonniermatthias at gmail.com> added the comment:

> Just to quickly touch on Matthias' question about opt-in or deprecations, a key thing to note is the ast module is automatically generated from the ASDL file, so either of those approaches would require developing a new mechanism in the code generator to support either approach.

Yes, I was mostly thinking of `compile(..., mode, flags=PyAstOnly)` as to where the deprecation could be. 

Thinking a bit more about the `compile`'s `multiline` option, that would also be quite useful to allow some construct that are so far forbidden, like top-level `await`.

I'm thinking that splitting `exec` into two options:
  - `module` which could do what current 3.7 does and find docstrings plus do some optimisation and sanity check if necessary, prevent top-level await. 
  - `multiline` which would treat the source as a sequence of statement, allwo top level `await` ... etc.

this could allow both to evolve and have their individual advantage, leaving `exec` unchanged for legacy reasons.

----------

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32911>
_______________________________________


More information about the Python-bugs-list mailing list