Message396758
Mypy is definitely not going to support direct access to `__parameters__`; what Guido is referring to is whether usage of types.Union that would require `__parameters__` at runtime is accepted by mypy.
For example, this:
from typing import TypeVar
T = TypeVar("T")
Alias = int | list[T]
def f(x: Alias[str]) -> None:
pass
But this produces `main.py:7: error: Variable "main.Alias" is not valid as a type`: mypy doesn't even recognize `|` as a type yet.
I'd rather not focus too much though on what mypy does; it is one of many type checkers by now and does not tend to be the quickest in adding support for new features.
Pyright does handle the file above as I'd expect, for what it's worth. |
|
Date |
User |
Action |
Args |
2021-06-29 22:26:10 | JelleZijlstra | set | recipients:
+ JelleZijlstra, gvanrossum, levkivskyi, brandtbucher, uriyyo, kj, jack__d |
2021-06-29 22:26:10 | JelleZijlstra | set | messageid: <1625005570.33.0.0604336861761.issue44490@roundup.psfhosted.org> |
2021-06-29 22:26:10 | JelleZijlstra | link | issue44490 messages |
2021-06-29 22:26:10 | JelleZijlstra | create | |
|