question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Options for preferring hanging indents with one item per line when formating lists

See original GitHub issue

I would like to add options/code so that yapf can be configured to prefer outputting something like

MyLongNamedTuple = (
    something.somethingelse,
    something.somethingelse,
    foo=(
        bar.somethingelse,
        something.asdfas,
    ),
)

over

MyLongNamedTuple = ( something.somethingelse,
    something.somethingelse, foo=( bar.somethingelse,
    something.asdfas),)

Issue Analytics

  • State:open
  • Created 8 years ago
  • Reactions:14
  • Comments:15 (8 by maintainers)

github_iconTop GitHub Comments

18reactions
KelSolaarcommented, Jul 2, 2017

Any news regarding this feature? We are heavy user of vertical lists and it would be a much appreciated option to have.

4reactions
bwendlingcommented, May 5, 2015

Probably the best thing that can be done here is to use the heuristic that if the list ends in a comma then we will try to place them on individual lines. Otherwise, we will do “bin packing” on the items in the list.

MyLongNamedTuple = [
    something.somethingelse,
    something.somethingelse,
    [
        bar.somethingelse,
        something.asdfas,
    ],
]

as opposed to:

MyLongNamedTuple = [
    something.somethingelse, something.somethingelse, [
        bar.somethingelse, something.asdfas
    ]
]
Read more comments on GitHub >

github_iconTop Results From Across the Web

Create a hanging indent - Microsoft Support
Select the text where you want to add a hanging indent. Go to Home > Paragraph dialog launcher Button image > Indents and...
Read more >
Formatting a Hanging Indent - Citing Your Sources
Highlight the citation(s) you want to indent. If you have multiple citation entries, make sure there is a single line of space between...
Read more >
Hanging Indents in Google Docs or Word (Made Easy)
You use hanging indents in a bibliography, reference list, and works cited. A hanging indent is where the second and subsequent lines of...
Read more >
Hanging Indents - Microsoft Word: Formatting Your Paper
On most computers, you can create a hanging indent by selecting the line you want indented and then holding down the Ctrl and...
Read more >
3 Formatting - Oracle Help Center
Under Alignment, select one of the three options. · Under Indentation, select one of the three options for Left Side. · Under Spacing,...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found