Следующее работает нормально:
Код: Выделить всё
from typing import TypedDict
Base_t = TypedDict('Base_t', {})
class Implementation_t(TypedDict):
one: str
two: int
implementation: Base_t = Implementation_t(one="one", two=2)
Код: Выделить всё
type Base_t = dict[str, str|int]
Естественно, типы ключей и значений Implementation_t являются подтипами Base_t соответственно.
Есть ли хороший способ обозначить это?
Подробнее здесь: https://stackoverflow.com/questions/797 ... -typeddict