Skip to content

Black should not change leading white space in doc strings #1698

@gar1t

Description

@gar1t

Black 20 is now changing this:

def p_col(p):
    """col : scalar_col
           | scalar_step_col
           | attr_col
           | flag_col
    """

to:

def p_col(p):
    """col : scalar_col
    | scalar_step_col
    | attr_col
    | flag_col
    """

Doc strings can be used for formatted text including, well, anything you want. In this case the doc strings are used by PLY to define a parsing grammar. This issue will effect anything that uses leading white space such as Markdown. It's bad form to start mucking with prose. You have no idea what's in there. White space that starts and ends the comment is fair game but not the content in between.

Metadata

Metadata

Assignees

No one assigned

    Labels

    F: docstringsHow we format docstringsT: styleWhat do we want Blackened code to look like?

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions