Skip to content
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

Indent if and else in multiline ternary statements #617

Closed
uycire opened this issue Nov 22, 2018 · 1 comment
Closed

Indent if and else in multiline ternary statements #617

uycire opened this issue Nov 22, 2018 · 1 comment
Labels
T: enhancement New feature or request

Comments

@uycire
Copy link

uycire commented Nov 22, 2018

Operating system: macOS Mojave
Python version: 3.7.0
Black version: 18.6b4
Does also happen on master: Yes

When I write a multi-line ternary statement in a dictionary, Black formats the if and else with the same indentation as the dictionary key.

print(
    {
        "ternary": "condition is true"
        if 1 + 1 == 2 and 2 + 2 == 4 and 4 + 4 == 8
        else "condition is false"
    }
)

I expected the if and else to be more indented, like this:

print(
    {
        "ternary": (
            "condition is true"
            if 1 + 1 == 2 and 2 + 2 == 4 and 4 + 4 == 8
            else "condition is false"
        )
    }
)
@ambv
Copy link
Collaborator

ambv commented Mar 4, 2020

This is essentially a subset of #620. Let's tackle that one instead.

@ambv ambv closed this as completed Mar 4, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants