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

decibyte picture decibyte  路  3Comments

JelleZijlstra picture JelleZijlstra  路  3Comments

J0 picture J0  路  3Comments

feluxe picture feluxe  路  3Comments

Curly-Mo picture Curly-Mo  路  3Comments