Formatting of list unpacking
- Dominant language
- Python
- Stars
- 14k
- Forks
- 904
- PR merge metrics
- No merged PRs in 30d
Description
On the following example, yapf formats the list unpacking in a very surprising way, in particular the `*` is separated from the list it unpacks:
```
return SomeNamedTuple(
{
'name':
Node('fooooooooooooooooo',
*[Node('=', 'x', 'y') for d in n[1:]])
}, [])
```
is reformatted as follows
```
$ yapf3 -v ; yapf3 -d test-yapf.py
yapf 0.29.0
--- test-yapf.py (original)
+++ test-yapf.py (reformatted)
@@ -1,6 +1,5 @@
return SomeNamedTuple(
{
- 'name':
- Node('fooooooooooooooooo',
- *[Node('=', 'x', 'y') for d in n[1:]])
+ 'name': Node('fooooooooooooooooo', *
+ [Node('=', 'x', 'y') for d in n[1:]])
}, [])
```
[Update] This issue persists on various configurations with yapf 0.30 (in github actions): python 3.7, 3.8, 3.9 and 3.10-alpha-5, as well as pypy-3.7. It does not appear with python 3.6 or pypy-3.6, though.
Contributor guide
Assessment
This issue has not been assessed yet.