google / google/yapf

Add style for multiline comprehensions

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

Description

If a comprehension can't fit on one line, splitting it to multiple lines on comprehension specific things would be good.

```
foo = [
some_func(value)
for value in a_long_named_iterable
if some_condition(value)
and not bad_thing(value)
]
```

Right now it's collecting the `for .. in .. if` all in one line rather than splitting them

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.