Black: Trailing comma for function with one arg

Created on 2 Jun 2019  路  4Comments  路  Source: psf/black

A function with one argument keeps the trailing comma but if there are two it is stripped.

In:

def one(
    a,
):
    pass

def two(
    a,
    b,
):
    pass

Out

def one(a,):
    pass


def two(a, b):
    pass

From https://black.now.sh/?version=stable&state=_Td6WFoAAATm1rRGAgAhARYAAAB0L-Wj4ACGAFNdAD2IimZxl1N_WlbvK5V-4TOOTwYyJEleH-JCdis69M0BXQy1O1PWCxUpRscYAufHo8BjrjIj1dM6YL_cyWPemFXxt1cpBhl0f8lWpI3sZ5u99cYAAACFuqAGuJSBnwABb4cBAAAAtWKNgbHEZ_sCAAAAAARZWg==

bug trailing comma

Most helpful comment

That's a bug, one should be formatted like so:

def one(a):
    pass

All 4 comments

That's a bug, one should be formatted like so:

def one(a):
    pass

I made pull request #891 with a potential fix. Please let me know if the approach makes sense and if you have any suggestions for improvement.

Looks like this was fixed in 9394de150ebf0adc426523f46dc08e8b2b2b0b63. Can this be closed?

yep.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

kissgyorgy picture kissgyorgy  路  3Comments

brettcannon picture brettcannon  路  3Comments

dusty-phillips picture dusty-phillips  路  3Comments

quodlibetor picture quodlibetor  路  3Comments

asottile picture asottile  路  3Comments