Deal with annotation on *args and **kwargs correctly, fixes #980

This commit is contained in:
Dave Halter
2019-07-23 23:56:30 +02:00
parent ff149b74e0
commit 703b747a31
2 changed files with 37 additions and 0 deletions

View File

@@ -165,3 +165,19 @@ def keyword_only(a: str, *, b: str):
a.startswi
#? ['startswith']
b.startswi
def argskwargs(*args: int, **kwargs: float):
"""
This might be a bit confusing, but is part of the standard.
args is changed to Tuple[int] in this case and kwargs to Dict[str, float],
which makes sense if you think about it a bit.
"""
#? tuple()
args
#? int()
args[0]
#? str()
next(iter(kwargs.keys()))
#? float()
kwargs['']