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
If a function takes a single argument which is a list, set, dict, or string, then the delimiters for those expressions can be immediately adjacent to the function's parentheses.
This would save both horizontal and vertical space, while also improving readability.
Multiline string handling has been improved in #1879 in the way you've presented in the Desired style. This is currently available in the preview style on the main branch and will be able under that flag once a new version is released.
I don't think the rest of the proposed changes fit with Black's intended style and it wouldn't quite follow the goal of minimizing diffs as much if another argument were passed to the function in the future. But I can't speak for maintainers so maybe I'm completely wrong here.
it wouldn't quite follow the goal of minimizing diffs as much if another argument were passed to the function in the future.
This is something that the developer can control using a trailing comma. If I have a single-argument function and I put a comma after the argument, then it means I anticipate that there could be more arguments in the future, and I want each of them to be on its own line. However, if I don't add a comma, then it means I don't think there will be new arguments for my function, or even if there would be, I'd prefer them to be in one line if possible.
Describe the style change
If a function takes a single argument which is a list, set, dict, or string, then the delimiters for those expressions can be immediately adjacent to the function's parentheses.
This would save both horizontal and vertical space, while also improving readability.
Examples in the current Black style
Desired style
Additional context
The text was updated successfully, but these errors were encountered: