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

Reflows of multiline blocks that have only one value don't include a comma #381

Closed
quodlibetor opened this issue Jun 27, 2018 · 3 comments
Closed
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. R: duplicate This issue or pull request already exists T: enhancement New feature or request

Comments

@quodlibetor
Copy link

Operating system:
Python version: any
Black version: 18.6b4
Does also happen on master: yes

# formatted
var = [
    # A Thing that is very important oooooooooooooooooooo aaaaaaaaaaaaaaaaaaaa
    "VALUE"
]

I would expect that to insert a comma after "VALUE" for consistency with the expected output if there are multiple values, for example:

# example 2 formatted
var = [
    # A Thing that is very important oooooooooooooooooooo aaaaaaaaaaaaaaaaaaaa
    "VALUE",
    "OTHER",
]
@carljm carljm added T: enhancement New feature or request F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. labels Jun 27, 2018
@carljm
Copy link
Collaborator

carljm commented Jun 27, 2018

In general Black doesn't add the trailing comma for single-element lists, but I can see how it maybe should do so when the list is exploded due to a comment. Thanks for the report!

@quodlibetor
Copy link
Author

Yup it's a edgy edge case.

@ambv
Copy link
Collaborator

ambv commented Aug 17, 2018

We will address this. It's a duplicate of #274.

@ambv ambv closed this as completed Aug 17, 2018
@ambv ambv added the R: duplicate This issue or pull request already exists label Aug 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
F: comments The syntactic kind. Not in the language grammar, always on our minds. Best bugs. R: duplicate This issue or pull request already exists T: enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

3 participants