Guido van Rossum <gu...@python.org> added the comment:

Looks like the more likely use case would be PEP 563:

from __future__ import annotations
from typing import TypeAlias, get_type_hints

import typing

class C:
    a: TypeAlias = int

print(get_type_hints(C))


This prints

Traceback (most recent call last):
  File "C:\Users\gvanrossum\cpython\t.py", line 9, in <module>
    print(get_type_hints(C))
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 1808, in get_type_hints
    value = _eval_type(value, base_globals, base_locals)
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 326, in _eval_type
    return t._evaluate(globalns, localns, recursive_guard)
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 690, in _evaluate
    type_ = _type_check(
  File 
"C:\Users\gvanrossum\AppData\Local\Programs\Python\Python310\lib\typing.py", 
line 171, in _type_check
    raise TypeError(f"Plain {arg} is not valid as type argument")

----------
nosy: +gvanrossum

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

Reply via email to