Skip to content

Content unnecessarily split onto multiple lines #1184

@tcbegley

Description

@tcbegley

Describe the bug A clear and concise description of what the bug is.

Black is spreading content across multiple lines that would easily fit on a single line. In particular the first example from the "how black wraps lines" in the docs here is not reproduced with black==19.10b0

To Reproduce Steps to reproduce the behavior:

  1. Make a Python file (demo.py) containing the snippet from the docs
j = [1,
     2,
     3,
]
  1. Run black demo.py (default arguments)
  2. Resulting file is formatted as
j = [
    1,
    2,
    3,
]

Expected behavior A clear and concise description of what you expected to happen.

According to the docs, and as was the case in earlier versions of Black (e.g. 19.3b0) output should be

j = [1, 2, 3]

Personally I think this is a much more reasonable output in this case.

Environment (please complete the following information):

  • Version: 19.10b0
  • OS and Python version: macOS, Python 3.7.4

Does this bug also happen on master?

Yes. See here

Metadata

Metadata

Assignees

No one assigned

    Labels

    R: not a bugThis is deliberate behavior of Black.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions