Код: Выделить всё
from typing import Union
class Vector:
def __mul__(self, other: Union["Vector", float]):
pass
Код: Выделить всё
class Vector:
def __mul__(self, other: "Vector" | float):
pass
TypeError: неподдерживаемые типы операндов для |: 'str' и ' type'
Это не поддерживается?
Подробнее здесь: https://stackoverflow.com/questions/726 ... r-and-type
Мобильная версия