Ok, if we're saying that it wouldn't be too abhorrent to treat Tuple differently, I do think supporting both cases is important for Tensor:

def foo(x: Tensor): ...
x: Tensor[Height, Width]

def bar(y: Tensor[Height, Width]): ...
y: Tensor

So I'll go ahead and state in the PEP that it should work both ways (and add some notes on our discussion about this to the Rationale section).

On Mon, 15 Feb 2021 at 04:33, Eric Traut <eric@traut.com> wrote:
I don't think it's feasible to change rules about tuple type compatibility at this point. Existing type stubs (including typeshed stubs) assume the current behavior. It's especially important for function overload matching. If we were to change the rules and make open-ended tuples assignable to fixed-sized tuples, the selected overload would change in some cases.

I also agree with Guido's justification for the current behavior (in the case of tuples). So even if it were feasible to change the behavior at this point, I don't think it would make sense to do so.

I'm not opposed to adopting different rules for (non-tuple) variadic generic classes if we think that the target use cases justify it. Of course, all things being equal, I'd favor consistency. Hopefully that's not considered a "foolish consistency". :)

Eric Traut
Contributor to Pyright & Pylance
Microsoft Corp.
Typing-sig mailing list -- typing-sig@python.org
To unsubscribe send an email to typing-sig-leave@python.org
Member address: mrahtz@google.com