This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author JelleZijlstra
Recipients JelleZijlstra, 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:10JelleZijlstrasetrecipients: + JelleZijlstra, gvanrossum, levkivskyi, brandtbucher, uriyyo, kj, jack__d
2021-06-29 22:26:10JelleZijlstrasetmessageid: <1625005570.33.0.0604336861761.issue44490@roundup.psfhosted.org>
2021-06-29 22:26:10JelleZijlstralinkissue44490 messages
2021-06-29 22:26:10JelleZijlstracreate