On 1/12/21 1:00 PM, Matthew Rahtz via Typing-sig wrote:
Guido had a really interesting suggestion in the last tensor typing meeting: what if, instead of creating a new constructor `TypeVarTuple`, we just did `TypeVar(bound=Tuple)`?
If I understand correctly the assertion is that: TypeVarTuple is effectively the same as: TypeVar(bound=Tuple[Type, ...]) which is a bit more specific than: TypeVar(bound=Tuple) (which is the phrasing you used). If in fact the shorter alternative form "TypeVar(bound=Tuple)" is incorrect and only the longer form "TypeVar(bound=Tuple[Type, ...])" is correct, I'd advocate to continuing using the existing proposed syntax "TypeVarTuple" over the (much) longer form. On 1/12/21 1:00 PM, Matthew Rahtz via Typing-sig wrote:
[...] well, the question is: is `Tuple[TrainBatch]` a subclass of `Tuple[Batch]`? That is, is `Tuple` covariant?
The answer here is also not obvious to me. (I'm pretty sure it *is* covariant, but only after remembering that [non-obvious] rule-of-thumb that "immutable usually means covariant, vs "mutable usually means invariant".) Yet my understanding is that this (non-obvious) answer is critical to whether a syntax like "TypeVar(bound=Tuple...)" makes intuitive sense to the reader. Depending on a non-obvious answer seems risky. On 1/12/21 1:00 PM, Matthew Rahtz via Typing-sig wrote:
To zoom out, though: one the other hand, we could also argue, "Let's not tie ourselves in knots about hypothetical future features. Let's choose the approach in the present which seems simplest and most elegant. Let's not overcomplicate the solution for the sake of all the things we might hypothetically want to do in the future."
I generally like this principle. On 1/12/21 1:00 PM, Matthew Rahtz via Typing-sig wrote:
So far I'm still leaning slightly towards creating a new constructor, in order to leave our options open later on. But I do feel mighty conflicted - the elegance of `TypeVar(bound=Tuple)` is undeniable. I'll mull this over a bit more.
Long story short, I'm generally in favor of staying with "TypeVarTuple". Best, -- David Foster | Seattle, WA, USA Contributor to TypedDict support for mypy