Author Jelle Zijlstra
Recipients Jelle Zijlstra, brandtbucher, gvanrossum, jack__d, kj, levkivskyi, uriyyo
Date 2021-06-29.22:26:10
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1625005570.33.0.0604336861761.issue44490@roundup.psfhosted.org>
In-reply-to
Content
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.
History
Date User Action Args
2021-06-29 22:26:10Jelle Zijlstrasetrecipients: + Jelle Zijlstra, gvanrossum, levkivskyi, brandtbucher, uriyyo, kj, jack__d
2021-06-29 22:26:10Jelle Zijlstrasetmessageid: <1625005570.33.0.0604336861761.issue44490@roundup.psfhosted.org>
2021-06-29 22:26:10Jelle Zijlstralinkissue44490 messages
2021-06-29 22:26:10Jelle Zijlstracreate