Skip to content

Some combos of *args/**kwds in caller/callee not supported #1892

Closed
@gvanrossum

Description

@gvanrossum

This spawned off #1553. The mapping of argument type from a call site to a function definition is complicated by the existence of *args, **kwds, optional args, and keyword-only args.

For example, Python 3.5+ support multiple *args in a call! (But not in a definition.) So this (valid) code gives two errors while there should be none:

def f(*a: int) -> int: return sum(a)
f(*[1, 2, 3], *[4, 5], 6)  # E: Too many arguments for "f"
f(*(1, 2, 3), *(4, 5), 6)  # E: Too many arguments for "f"

(It also doesn't give a SyntaxError with --python-version=3.4 as it should.)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions