Skip to content
This repository was archived by the owner on Nov 3, 2023. It is now read-only.
This repository was archived by the owner on Nov 3, 2023. It is now read-only.

Please give us feedback about AST change in Python 3.7  #305

@methane

Description

@methane

In Python 3.6, docstring was expression in AST.

FunctionDef(name='foo', ..., body=[Expr(value=Str(s='docstring'))], ...)

Since docstring is special and it's unclear that expression is docstring or not, we changed AST in 3.7a1.
docstring is moved from body to field. (bpo-29463)

FunctionDef(name='foo', ..., body=[], ..., docstring='docstring')

But it removed syntactic information about docstring (e.g. lineno). We are considering changing it again. Docstring is moved back to body, but it is special statement named DocString(s). Expr(value=Str(s)) is not docstring. (bpo-32911)

FunctionDef(name='foo', ..., body=[DocString(s='docstring')], ...)

It means tools broken by 3.7a1 will be broken again. But 3.7b3 will be the last chance to change AST.

How do you think about it? Please give comment / vote on the issue tracker.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions