Skip to content

E231: Check misses trailing comma in function or class calls that do not end with whitespace #980

Open
@lfiedler

Description

Trailing commas in function calls, e.g. print(1,2,) that do not end with a white space are not flagged by pycodestyle.
From reading the corresponding PEP8 I would expect that pycodestyle would flag this.

Here's a small example:

def f(a, b):
    return a+b


class A:
    def __init__(self, a):
        self.a = a


if __name__ == "__main__":
    A(f(1, 2,),)
    print(f(1, 2,))
    print(1, 2,)

Although this is valid python code I'd expect pycodestyle to flag all of the three last lines, but it doesn't.
Is this behaviour expected?

Environment:

  • Python 3.8.5
  • conda 4.9.2
  • pycodestyle 2.6.0

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions