Files
openide/python/testData/inspections/PyUnresolvedReferencesInspection/varargsAnnotatedWithFunctionComment.py
Mikhail Golubev 030853a3e2 PY-18254 IDEA-CR-8433 Represent types of varargs annotated with **T or *T as dicts and raw tuples
Type of vararg parameter should be seen differently inside
method body and at the call site. For instance, in case of positional
vararg, it should be represented as "Iterable[T]" in function quick
doc, but as "Tuple[T, ...]" inside its body, because without the latter
type checker might complain about missing tuple's methods called on
such parameter. Unfortunately, we're not able to represent homogeneous
tuples of arbitrary length in our type system so far, so it's just raw
tuple for now.

The same thing applies to keyword varargs, since collections.Mapping
doesn't contain all methods defined for built-in dict. At least we can
parametrize type of the standard dict properly with the types of its
keys and values.
2016-02-15 17:45:44 +03:00

5 lines
102 B
Python

def f(*args, **kwargs):
# type: (*str, **str) -> None
args.index('foo')
kwargs.pop('bar')