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

Undesired split after multiline triple quoted string. #1876

Closed
iago-lito opened this issue Dec 21, 2020 · 1 comment
Closed

Undesired split after multiline triple quoted string. #1876

iago-lito opened this issue Dec 21, 2020 · 1 comment
Labels
R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?

Comments

@iago-lito
Copy link

I've got an undesired split after multiline """ string when searching the sea monster in yesterday's AoC:

pattern = """
                  # 
#    ##    ##    ###
 #  #  #  #  #  #   
""".strip(
    "\n"
)

I'd rather keep what I initially wrote:

pattern = """
                  # 
#    ##    ##    ###
 #  #  #  #  #  #   
""".strip("\n")

I'm also suprised because none of the above hits the max width, any idea why the splitting occurs?

@iago-lito iago-lito added the T: style What do we want Blackened code to look like? label Dec 21, 2020
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label Dec 22, 2020
@ichard26
Copy link
Collaborator

Duplicate of #256.

Why the line break?

Black considers multiline strings as always not fitting a single line (per definition), so it tries to break the line if possible. I agree that in this case the result is sub-optimal. I'll see what I can do to improve this.

#256 (comment)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants