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:
demo.py) containing the snippet from the docsj = [1,
2,
3,
]
black demo.py (default arguments)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):
19.10b0Does this bug also happen on master?
Yes. See here
A trailing comma forces the dictionary literal to be expanded across multiple lines. If you remove the comma after 3 you'll get the output you expect. Do you have any suggestions about how to make this behavior clearer in the docs?
I've fixed the example in the doc itself
I see, thanks for changing that example and for clarifying that this behaviour is expected.
Do you have any suggestions about how to make this behavior clearer in the docs?
Is it actually documented? Despite searching I couldn't find a description of this behaviour in the docs. I would have maybe expected something in either the section on trailing commas or how black wraps lines. The only place I found any mention of it was the changelog. Some mention of this behaviour in either (both?) of those sections of the docs would be helpful I think.
Since March 4th, there now is documentation on this specific behaviour and feature. This is the commit that introduces it: https://github.com/psf/black/commit/e253f1260d234ff925cbdbb77c140da8aa81190b.
This issue is now resolved. @tcbegley, thank you for opening the issue!
Most helpful comment
I see, thanks for changing that example and for clarifying that this behaviour is expected.
Is it actually documented? Despite searching I couldn't find a description of this behaviour in the docs. I would have maybe expected something in either the section on trailing commas or how black wraps lines. The only place I found any mention of it was the changelog. Some mention of this behaviour in either (both?) of those sections of the docs would be helpful I think.