21 Sep
2020
21 Sep
'20
7:15 p.m.
Let's say I have the following function: ```python def spam(a: str, b: str, c: str, d: int = 42): ... ``` Now if I call that with: ```python spam(*"a/b".split("/", 2), "hello") ``` That will execute fine and actually result in appropriate types for those arguments. Unfortunately both Pylance and mypy say that call is incompatible because of `str.split(...) -> List`. And since 'typing' lacks an concept of a sized list like it does for tuples, I don't know how to make this pass. Am I overlooking something? Or is this a gap due to there not being an equivalent of 'SizedList' in 'typing'?