-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Closed
Labels
F: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?
Description
Describe the style change
Original code:
function_call(
(
" lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor"
" incididunt ut labore et dolore magna aliqua Ut enim ad minim"
),
" veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo",
)
Examples in the current Black preview style
black --preview removes the parens since they are "not necessary":
function_call(
" lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor"
" incididunt ut labore et dolore magna aliqua Ut enim ad minim",
" veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo",
)
Desired style
Keep the parens:
function_call(
(
" lorem ipsum dolor sit amet consectetur adipiscing elit sed do eiusmod tempor"
" incididunt ut labore et dolore magna aliqua Ut enim ad minim"
),
" veniam quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo",
)
Additional context
Parens in this case can increase readability, Black can choose to NOT universally add parens for them (see #3162 (comment)). However, if the code explicitly adds parens to the implicitly concatenated strings, I suggest Black not removing them as the parens are indications of needing to wrap the string to increase readability.
This might be not necessary if Black chooses to use explicit str concatenations (#2553).
chasefinch, boxed and aaossa
Metadata
Metadata
Assignees
Labels
F: parenthesesToo many parentheses, not enough parentheses, and so on.Too many parentheses, not enough parentheses, and so on.F: stringsRelated to our handling of stringsRelated to our handling of stringsT: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?