Replies: 1 comment 1 reply
|
As you point out, the spec allows multiple As for your second question, there are good reasons why multiple The type |
|
As you point out, the spec allows multiple As for your second question, there are good reasons why multiple The type |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
This is related to #1439. Currently, the typing specs say:
In practice, this restriction seems to only apply to type parameters specified on generic types, not generic functions/methods. mypy and pyright accepts multiple
TypeVarTuples in the latter, and can even solve for them indirectly:The ambiguity mentioned in the specs,
x: Array[int, str, bool] # Ts1 = ???, Ts2 = ???, seems to only apply when type arguments are provided to a generic type likeArray(or in C++ terminology, explicit rather than deduced). The ambiguity currently does not even seem possible with functions/methods, as they can't be subscripted. So,TypeVarTuples to be allowed for generic functions/methods (def concat_args_and_ret[*A, *R]) in the future?-> tuple[*A, *R](perhaps indirectly, like-> tuple[*A, *tuple[*R]])?All reactions