[New-bugs-announce] [issue30497] Line number of docstring in AST

Steven Myint report at bugs.python.org
Sun May 28 14:44:26 EDT 2017

New submission from Steven Myint:

Since #29463, it is no longer obvious how to get the line number of a docstring in the AST:

    import ast

    x = ast.parse('''\
    def foo():
        """This is a docstring."""

    # In Python 3.6, the docstring and line number would be:

    # In Python 3.7, I don't know what the equivalent would be.
    # Line number?

We use this feature in pyflakes (https://github.com/PyCQA/pyflakes/issues/271).

components: Interpreter Core
messages: 294654
nosy: myint
priority: normal
severity: normal
status: open
title: Line number of docstring in AST
versions: Python 3.7

Python tracker <report at bugs.python.org>

More information about the New-bugs-announce mailing list