Код: Выделить всё
class Foo:
pass
class FooChild(Foo):
pass
class Bar:
def __init__(self):
self.prop: Foo
class BarChild(Bar):
def __init__(self):
self.prop: FooChild = FooChild()
Код: Выделить всё
"prop" overrides symbol of same name in class "Bar"
Variable is mutable so its type is invariant
Override type "FooChild" is not the same as base type "Foo"
Подробнее здесь: https://stackoverflow.com/questions/793 ... f-its-type
Мобильная версия