-
Notifications
You must be signed in to change notification settings - Fork 2.7k
Closed
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?
Description
I looked through some issues and didn't see any like this. Sorry if this is a duplicate or already discussed. I noticed something I thought was strange and probably the first thing I didn't like about black formatted code 😄
Something like this:
some_kind_of_data = "foo"
some_other_kind_of_data = "bar"
print(
dict(
a=1,
b=2 if some_kind_of_data is not None else some_other_kind_of_data, # some explanation of why this is actually necessary
c=3,
)
)Using black (python3.7.3, black 19.10b0), becomes:
some_kind_of_data = "foo"
some_other_kind_of_data = "bar"
print(
dict(
a=1,
b=2
if some_kind_of_data is not None
else some_other_kind_of_data, # some explanation of why this is actually necessary
c=3,
)
)Desired style How do you think Black should format the above snippets:
Either leave it obnoxiously long, or add parenthesis / indentation
some_kind_of_data = "foo"
some_other_kind_of_data = "bar"
print(
dict(
a=1,
b=(
2 if some_kind_of_data is not None else some_other_kind_of_data
), # some explanation of why this is actually necessary
c=3,
)
)sebastian-fredriksson-bernholtz
Metadata
Metadata
Assignees
Labels
F: linebreakHow should we split up lines?How should we split up lines?T: styleWhat do we want Blackened code to look like?What do we want Blackened code to look like?