google / google/yapf

Don't always force one-element-per-line when a sequence literal contains a comma after the last element

Open
#561 9 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
14k
Forks
904
PR merge metrics
No merged PRs in 30d

Description

As of 0.21.0, yapf formats
```
_MY_CONSTANT = (3,4,5,6,7)
```
as
```
_MY_CONSTANT = (3, 4, 5, 6, 7)
```
and formats
```
_MY_CONSTANT = (3,4,5,6,7,)
```
as
```
_MY_CONSTANT = (
3,
4,
5,
6,
7,
)
```
(the only difference between the two inputs is the comma after the last element). I'd much rather the latter form, which I prefer writing, were laid out much more compactly. If there's any reason why it shouldn't be compact, I'm having trouble seeing it.

(We use yapf for all the Python code in [gRPC Python](https://github.com/grpc/grpc/tree/master/src/python) and this is my biggest complaint, so congratulations on everything else about it being great!)

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.