-
-
Notifications
You must be signed in to change notification settings - Fork 348
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
Formatting suggestion: if-blocks with multiple conditions #1068
Comments
I would tend to agree, but recognise others may not. It makes diffs better if you add a new condition, its just a new line being added, rather than a new line being added and the The placement of |
@pschmitt it seems you're confused. Want to elaborate? :) |
@ColemanTom refers to the
rather than with
Binary operators like You could say that
But then, should the lack of the flag, i.e. the default behavior, enforce the opposite style?
This I'm less convinced about - while consistency is good in formatting, we also don't want to fight the user's intent, and both forms seem OK to me. Plus, we haven't enforced anything by default so far, so it could be a surprising change to make. Overall I'm mildly in favor of this change, but it feels low-priority. |
@mvdan I appreciate you taking the time to look into this. The approach with requiring
vs
I also understand the low-priority of this. (Hopefully, AI in the future will allow us to make such changes more easily—where most of the work is about discussing policy as opposed to implementation.) |
Hi @mvdan, I have a formatting suggestion involving if-blocks.
Instead of doing this:
reformat like this:
The formatting is inspired by what Python does with the black formatter. I think it makes the code more readable. (For operator placement, see also here.)
The text was updated successfully, but these errors were encountered: