Код: Выделить всё
type IntList = list[int] # This line causes the error
type OtherType = int # This line causes the error
class test:
pass
type SomeType = test # This line causes the error
Изменить:
Похоже, у меня нет ошибок из MyPy, если я делаю это таким образом.
Код: Выделить всё
IntList: TypeAlias = list[int]
OtherType: TypeAlias = int
class test:
pass
SomeType: TypeAlias = test
Как создать псевдоним типа в Python?
Это из-за вариант в Python 3.9+?
Подробнее здесь: https://stackoverflow.com/questions/783 ... -supported