-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
hug_parens_with_braces_and_square_brackets
: Doesn't hug if all entries fit on a line
#4099
Comments
Just to confirm, your preferred style uses an 8-space indent, which is unusual and inconsistent with the rest of Black's style. Did you mean to use a 4-space indent, or are you proposing to indent further in that case? Assuming we use 4-space indents, I'm not sure which style is better, but I'm definitely open to revisiting the style. I think I explicitly asked for the current style on one of the related PRs, because the style you're asking for seemed too disruptive. You say (correctly) that your proposed style minimizes diffs better if entries are added to the dictionary. That's true, but your style is worse for diffs if a second argument is added to the function call. Maybe that's less common though? |
Sorry, no. It's just GitHub defaulting to tab. I need to check my settings if I can change this somewhere. The indentation should remain as is. It's only about the placement of the opening and closing curly
Thanks for the context. That makes sense from a transitioning perspective and I'm unfamiliar with how Black prioritises consistency vs disruption due to the new formatting.
That's true, but isn't it inherit to |
Yes, it's inherit to I think the proposed change here is probably more consistent? I think hug is already changes enough formatting that we should try to favour more consistent rules (possibly unless you think the primary benefit of hug is reducing vertical space) |
Describe the style change
This issue is specific to the new
hug_parens_with_braces_and_square_brackets
preview style.Examples in the current Black style
Desired style
The benefit of the desired style in my view are:
It minifies the diff when the length of the entires change because the formatting of the
{
remain unchanged:or
It feels more consistent with the call expression formatting where the opening are formatted on separated lines (which is necessary to avoid invalid syntax):
Additional context
Originally posted in the stable 2024 style issue.
The text was updated successfully, but these errors were encountered: