Jelle Zijlstra <jelle.zijls...@gmail.com> added the comment:

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.

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue44490>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to