Skip to content

Long with statements are not broken into several lines #664

@mhham

Description

@mhham

Long with statements are not not broken into several lines:

Something like this should be OK, according to PEP8

with averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater, \
     averylongnameyoucantsplit as youcheater:
    print("hello")

But black formats its as:

with averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater, averylongnameyoucantsplit as youcheater:
    print("hello")

Operating system: macOS 10.14.2
Python version: 3.7.2
Black version: 18.9b0
Does also happen on master: Yes

Metadata

Metadata

Assignees

No one assigned

    Labels

    C: target versionRelated to --target-version, e.g. autodetectionF: linetoolongBlack makes our lines too longF: parenthesesToo many parentheses, not enough parentheses, and so on.S: acceptedThe changes in this design / enhancement issue have been accepted and can be implementedT: 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