10

yapf formatter can wrap long lines in the code inside parentheses in the expression in the list comprehension:

threads = [threading.Thread(
    target=worker, args=[q], daemon=True) for _ in range(worker_count)]

I want to wrap just before the for-loop instead:

threads = [threading.Thread(target=worker, args=[q], daemon=True)
           for _ in range(worker_count)]

yapf --help-style doesn't show anything obvious that can help here.

I can add # yapf: disable at the end of the line, to disable yapf. Is there some other way to force different formatting preference?

Current yapf/style settings:

[style]
based_on_style = pep8
column_limit = 89

Version:

>>> import yapf
>>> yapf.__version__
'0.13.2' # the latest on github
Community
  • 1
  • 1
jfs
  • 399,953
  • 195
  • 994
  • 1,670

0 Answers0