-
Notifications
You must be signed in to change notification settings - Fork 121
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
Allow the condition part of a split conditional expression on the same line as an assignment #1465
Comments
I think the current tall style might be an improvement. The case in df97775 looks better with the first operand on the next line because it makes the indentation against that operand more obvious.
Is your example correct? I though the condition operand would have less indentation than the branches while you show them aligned. |
You might be right. I tend to prefer the condition being on the same line as the assignment when it fits, but it's mostly just an aesthetic preference. (For what it's worth, I think the old short style more or less keeps the condition expression on the first line in these cases, though I'm not 100% sure since the rules are quite different.)
I think it looks OK like that, but that's a good question. I could see us going either way. I think we'd have to see what actually works with the surrounding code and is implementable. |
I would prefer keeping the condition on the same line. I also find it looks more visually pleasing, particularly in widgets trees. |
In the tall style, we generally split at the operator of an "assignment" (
=
,:
, or=>
) if the right hand side splits (and it's block-like). So these are all fine:Currently, that implies that when a conditional expression splits, the entire expression is moved down past the operator, like:
I think it would look nicer if we allowed the condition part to stay on the same line as the assignment in that case:
Note that this would only apply if the condition part of the conditional expressions fits on one line. If the condition itself splits, then we should also split the surrounding assignment. So this wouldn't be allowed:
And you would instead get:
The text was updated successfully, but these errors were encountered: