-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Description
Black's wrapping of lists to fit a single line causes diffs to become bigger,
and often makes the code harder to read.
When removing the 3rd line from the list used in the for loop, it will become
short enough to fit a single line and black re-formats it:
Orig:
normid = p.basename + "::TestClass::()::test_method"
for id in [
p.basename,
p.basename + "::TestClass",
p.basename + "::TestClass::()",
normid,
]:New:
normid = p.basename + "::TestClass::()::test_method"
for id in [
p.basename,
p.basename + "::TestClass",
normid,
]:Black:
normid = p.basename + "::TestClass::test_method"
for id in [p.basename, p.basename + "::TestClass", normid]:I think black should instead keep the original list style (which matches what
black would do with more entries), and only remove the single line.
This would not need an option, but could be respected in general: if a list (or
dictionary etc) is wrapped already like black would wrap it with more entries
than would fit on a single line it should keep it like this.
The list itself should still get re-formatted, but should just be considered to not fit a single line.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels