Braces example for multiline conditionals#284
Merged
Conversation
|
|
||
| * When you break a long expression at a binary operator, the | ||
| operator goes at the end of the previous line, e.g.:: | ||
| operator goes at the end of the previous line, and braces should be |
Member
There was a problem hiding this comment.
Actually I think the brace should be moved only if the indentation of continuation lines matches the indentation of the following code. In the following case the brace should be kept at the end of the line:
if (PyErr_WarnFormat(PyExc_DeprecationWarning, 1,
"invalid escape sequence '\\%c'",
*first_invalid_escape) < 0) {
Py_DECREF(result);
return NULL;
}
Member
Author
There was a problem hiding this comment.
That actually looks a bit weird to me, though I can understand the rationale. I'd personally prefer a rule that states the open brace not to be hanging in all multiline conditional cases.
vstinner
approved these changes
Jun 4, 2017
vstinner
left a comment
Member
There was a problem hiding this comment.
My heuristic is { on the if line, but on on a newline if the if takes at least 2 lines.
csabella
reviewed
Jun 6, 2017
| * When you break a long expression at a binary operator, the | ||
| operator goes at the end of the previous line, e.g.:: | ||
| operator goes at the end of the previous line, and braces should be | ||
| formatted as show. E.g.:: |
Contributor
There was a problem hiding this comment.
Should this be 'as shown'?
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #283