Skip to content

Better support for docstrings #47

@hauntsaninja

Description

@hauntsaninja

Thanks for a useful library!

astunparse doesn't special case docstrings:

>>> print(astunparse.unparse(ast.parse('''def f(): """multi\n    line\n    docstring\n    """ ''')))

def f():
    'multi\n    line\n    docstring\n    '

whereas Python 3.9 handles it more idiomatically:

>>> print(ast.unparse(ast.parse('''def f(): """multi\n    line\n    docstring\n    """ ''')))

def f():
    """multi
    line
    docstring
    """

Note the implementation in Python 3.9 also handles other issues, like #38, better.

More generally, I was wondering if there's a plan to attempt to use the Python 3.9 implementation. Let me know if this is something you want and if you would want help!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions