Skip to content

Style: removing unnecessary usages of \ from the codebase #11954

Closed
@wesm

Description

@wesm

I've found that using parentheses (which allow for automatic continuation) instead of \ results in a lot more readable code. The lone exception is using \ with long strings and avoiding a line break at the start of the string.

Worse:

return GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOD and LET and THE and HATE and FLOW\
    and THROUGH and YOU

Better:

return (GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOD and LET and THE and HATE and FLOW
        and THROUGH and YOU)

OK:

return """\
GOOOOOOOOOOOOOOOOOOOOOOOOOOOOOOD and LET and THE and HATE and FLOW
and THROUGH and YOU"""

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions