MCVE:
class A:
def __init__(self, num: int):
self.value = num
class B(A):
def __init__(self): # Mypy: function is missing a type annotation
A.__init__(self, 7) # Mypy: Expression has type "Any"
Я бы хотел, чтобы Mypy не заставляла меня печатать self
.Мне кажется очевидным, что это за тип self
, и Mypy может вычислить его для A
, так почему бы не B
?
Как я могу определить B
так, чтобы яменя не заставляют делать следующее?
class A:
def __init__(self, num: int):
self.value = num
class B(A):
def __init__(self: 'B'):
A.__init__(self, 7)