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

When trailing comma present, force explode formatting #499

Closed
jasonkuhrt opened this issue Sep 4, 2018 · 2 comments
Closed

When trailing comma present, force explode formatting #499

jasonkuhrt opened this issue Sep 4, 2018 · 2 comments

Comments

@jasonkuhrt
Copy link

jasonkuhrt commented Sep 4, 2018

The following is an example of the idea being proposed.

By the current standards of black (modulo column size) this is considered readable style:

    return Response(
        statusCode=status_code, body=safe_json.dumps(body or dict()), headers=headers
    )

I personally disagree. I understand black is adverse toward configuration, and appreciate the justification for that. So my proposal here is that a trailing comma can force the explosion, like so:

Given a trailing comma:

    return Response(
        statusCode=status_code, body=safe_json.dumps(body or dict()), headers=headers,
    )

Black would format like so:

    return Response(
        statusCode=status_code,
        body=safe_json.dumps(body or dict()),
        headers=headers,
    )

The benefits are:

  1. more readable IMHO
  2. more friendly to viewing version control system [git, ...] diffs
@zsol
Copy link
Collaborator

zsol commented Sep 4, 2018

One of the basic principles of black is that input formatting has no effect on output formatting. This is unlikely to change. About "readable style", there's already a discussion happening over at #404 so I'll close this out.

@zsol zsol closed this as completed Sep 4, 2018
@jasonkuhrt
Copy link
Author

I'll keep my eye on #404 thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants