-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Open
Labels
topic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-error-reportingHow we report errorsHow we report errorstopic-usability
Description
(Originally reported at python/typeshed#814, which gives an example from real code.)
def foo(a: int, b: str = '') -> None: ...
foo(1) # OK
foo(*[1]) # E: Argument 1 to "foo" has incompatible type *List[int]; expected "str"
Ideally this shouldn't be an error at all (this works fine at runtime), but I imagine it's hard for mypy to accept this code since it doesn't know how long the list is. However, we could at least fix the error message, which talks about "argument 1" needing to be a str when really it's argument 2 that is the problem.
Metadata
Metadata
Assignees
Labels
topic-callsFunction calls, *args, **kwargs, defaultsFunction calls, *args, **kwargs, defaultstopic-error-reportingHow we report errorsHow we report errorstopic-usability