Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Compact multi-line function call #1865

Closed
stephane-2 opened this issue Dec 12, 2020 · 3 comments
Closed

Compact multi-line function call #1865

stephane-2 opened this issue Dec 12, 2020 · 3 comments
Labels
R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?

Comments

@stephane-2
Copy link

stephane-2 commented Dec 12, 2020

Currently, Black reformats a long nested call like foo(bar(<long argument list>)) to

foo(
    bar(
       <long argument list>
    )
)

An alternative more compact way would be

foo(bar(
    <long argument list>
))

This style is particularly natural when foo(bar is viewed conceptually as a single call to a composed function.
The proposal is to add support to Black for this type of compact formatting (which could also be applied to nested "quasi-calls", like list literals).

Support could be added in several ways:

  1. Add an option to not reformat such compact style.
  2. Add an option to reformat into this compact style whenever possible.
  3. (1.) or (2.), but as default behavior, rather than options.
@stephane-2 stephane-2 added the T: enhancement New feature or request label Dec 12, 2020
@ichard26 ichard26 added T: style What do we want Blackened code to look like? and removed T: enhancement New feature or request labels Apr 2, 2021
@ichard26 ichard26 added the R: duplicate This issue or pull request already exists label May 30, 2021
@ichard26
Copy link
Collaborator

Closing as a duplicate and in favour of #2071.

@stephane-2
Copy link
Author

@ichard26 #2071 does not mention nested function calls. Should I add a comment to #2071 about it, or is the fact that this issue is mentioned in #2071 sufficient?

@ichard26
Copy link
Collaborator

ichard26 commented Jun 2, 2021

Well, I'd say they fall under the same umbrella, but a short comment probably wouldn't hurt either.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
R: duplicate This issue or pull request already exists T: style What do we want Blackened code to look like?
Projects
None yet
Development

No branches or pull requests

2 participants