Message412685
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") |
|
Date |
User |
Action |
Args |
2022-02-06 23:16:00 | gvanrossum | set | recipients:
+ gvanrossum, JelleZijlstra, kj, GBeauregard |
2022-02-06 23:16:00 | gvanrossum | set | messageid: <1644189360.57.0.223048959549.issue46655@roundup.psfhosted.org> |
2022-02-06 23:16:00 | gvanrossum | link | issue46655 messages |
2022-02-06 23:16:00 | gvanrossum | create | |
|