But in a non-toy example how do you expect a static checker to know how many items "a/b".split("/", 2) returns? Hopefully you're not expecting the checker to evaluate "a/b".split("/", 2) at compile time?I could only see making this pass by using cast(Tuple[str, str], "a/b".split("/", 2)).On Mon, Sep 21, 2020 at 12:15 PM Brett Cannon <brett@python.org> wrote:_______________________________________________Let's say I have the following function:```pythondef spam(a: str, b: str, c: str, d: int = 42): ...```Now if I call that with:```pythonspam(*"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'?
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: guido@python.org
--_______________________________________________--Guido van Rossum (python.org/~guido)Pronouns: he/him (why is my pronoun here?)
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
https://mail.python.org/mailman3/lists/typing-sig.python.org/
Member address: tsudol@google.com