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",
]
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!
Yup it's a edgy edge case.
We will address this. It's a duplicate of #274.
Most helpful comment
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!