keyword-arg-before-vararg / W1113ΒΆ

Message emitted:

Keyword argument before variable positional arguments list in the definition of %s function


When defining a keyword argument before variable positional arguments, one can end up in having multiple values passed for the aforementioned parameter in case the method is called with keyword arguments.

Problematic code:

def func(x=None, *args):  # [keyword-arg-before-vararg]
    return [x, *args]

Correct code:

def func(*args, x=None):
    return [*args, x]

Created by the typecheck checker.