-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?
Description
Describe the style change
Currently black splits lines from the outermost expression to the innermost expression. This makes sense in most cases, but there is some cases where preferring the inner expression is more semantic. This is especially true if the only argument of a function is a dictionary.
Examples in the current Black style
f(
{
"foo": "This is a dict",
"bar": "with values that are too long",
"baz": "to fit on a line.",
}
)
Desired style
f({
"foo": "This is a dict",
"bar": "with values that are too long",
"baz": "to fit on a line.",
})In this example the first break (putting the dict on it’s own line) doesn’t even make the lines any shorter.
Additional context
It’s hard to make a general rule out of this. Perhaps splitting expressions first that have many child-expresssions would be a reasonable heuristic, but I’m happy for suggestions.
codethief, YodaEmbedding, Hyperx837, MajorDallas, jl-compileit and 31 moreYodaEmbeddingYodaEmbeddingYodaEmbeddingYodaEmbedding
Metadata
Metadata
Assignees
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?