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

Black no longer removes the trailing comma from function arguments #1228

Closed
alexwlchan opened this issue Jan 13, 2020 · 2 comments
Closed

Black no longer removes the trailing comma from function arguments #1228

alexwlchan opened this issue Jan 13, 2020 · 2 comments
Labels
T: bug Something isn't working

Comments

@alexwlchan
Copy link

If a function has a trailing comma in the argument list, black does not remove it.

Start from:

def one(
    a,
):
    pass

def two(
    a,
    b,
):
    pass

Run black over that file, and you get:

def one(a,):
    pass


def two(
    a, b,
):
    pass

I would expect something more like:

def one(a):
    pass


def two(a, b):
    pass

Environment:

  • Version: I can reproduce this in release and master builds; 19.10b0 and 19.10b1.dev16+g1ab87a3
  • OS and Python version: macOS, Python 3.7.5

Does this bug also happen on master? Yes.

Additional context

Possibly related issues:

I had a look for duplicates in the trailing-comma label, couldn't find any.

@alexwlchan alexwlchan added the T: bug Something isn't working label Jan 13, 2020
@duichwer
Copy link

I think, what is even worse that black also adds a trailing comma to my parameter list.

@zsol
Copy link
Collaborator

zsol commented Jan 16, 2020

This is the same as #1202.

@zsol zsol closed this as completed Jan 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
T: bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants