You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Operating system: MacOS
Python version: 3.7.0 Black version: 18.6b4
Does also happen on master: yes
I can't quite tell if this is intended behavior or if it is emergent behavior caused by other things.
I noticed this because black and isort (configured with multi_line_output = 3 and include_trailing_comma = True) started fighting over a particular line.
Per the trailing comma rules, it it my understanding that all multi-member expressions defined over multiple lines should have a trailing comma at the end of each member line, but expressions that fit on a single line and do not syntactically require a trailing comma will have that trailing comma removed.
This is good, and in my experience this is what black does. However, there is an edge case that is not directly addressed in the rules in the readme: an expression that can contain multiple members but only contains a single member and cannot fit on a single line.
Based on my understanding of the reason behind the adding trailing commas to the end of multi-line expression members (making diffs less bad), I would think that the single member in these cases should still have a trailing comma.
However, based on the "remove trailing commas on single line expressions unless syntactically necessary" exception, the trailing comma should not be present.
The behavior that black applies follows the rules that would be followed if the expressions were contained on a single line. Is this intentional? If so, could a mention of this exception be added to the readme?
Operating system: MacOS
Python version: 3.7.0
Black version: 18.6b4
Does also happen on master: yes
I can't quite tell if this is intended behavior or if it is emergent behavior caused by other things.
I noticed this because
black
andisort
(configured withmulti_line_output = 3
andinclude_trailing_comma = True
) started fighting over a particular line.Per the trailing comma rules, it it my understanding that all multi-member expressions defined over multiple lines should have a trailing comma at the end of each member line, but expressions that fit on a single line and do not syntactically require a trailing comma will have that trailing comma removed.
This is good, and in my experience this is what
black
does. However, there is an edge case that is not directly addressed in the rules in the readme: an expression that can contain multiple members but only contains a single member and cannot fit on a single line.Based on my understanding of the reason behind the adding trailing commas to the end of multi-line expression members (making diffs less bad), I would think that the single member in these cases should still have a trailing comma.
However, based on the "remove trailing commas on single line expressions unless syntactically necessary" exception, the trailing comma should not be present.
The behavior that
black
applies follows the rules that would be followed if the expressions were contained on a single line. Is this intentional? If so, could a mention of this exception be added to the readme?input:
output:
The text was updated successfully, but these errors were encountered: