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

Add trailing comma test case for hugging parens #3991

Merged
merged 1 commit into from Oct 27, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
13 changes: 13 additions & 0 deletions docs/the_black_code_style/future_style.md
Expand Up @@ -139,6 +139,19 @@ foo([
])
```

You can use a magic trailing comma to avoid this compacting behavior; by default,
_Black_ will not reformat the following code:

```python
foo(
[
1,
2,
3,
],
)
```

### Improved multiline string handling

_Black_ is smarter when formatting multiline strings, especially in function arguments,
Expand Down
Expand Up @@ -36,6 +36,14 @@ def foo_square_brackets(request):
]
)

func(
[
'a',
'b',
'c',
],
)

func( # a
[ # b
"c", # c
Expand Down Expand Up @@ -171,6 +179,14 @@ def foo_square_brackets(request):
"c",
])

func(
[
"a",
"b",
"c",
],
)

func([ # a # b
"c", # c
"d", # d
Expand Down