Skip to content

.arguments property ignores keyword-only args, *args, and **kwargs #2213

@jacobtylerwalls

Description

@jacobtylerwalls
>>> from astroid import extract_node
>>> node = extract_node("""def a(*args, b=None, c=None, **kwargs): ...""")
>>> node.args.arguments
[]

Expected to find all the arguments from the function signature.

The wanted data can be found here:

>>> node.args.vararg
'args'
>>> node.args.kwarg
'kwargs'
>>> node.args.kwonlyargs
[<AssignName.b l.1 at 0x1048189b0>, <AssignName.c l.1 at 0x104818830>]

Discussed at pylint-dev/pylint#7577 (comment).

Notice that positional-only args are found for some reason 🤷

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions