When I write the following code, mypy issues an error (like it should):
from typing import TypeVar, Generic, List
Data = TypeVar("Data")
class State(Generic[Data]):
def __init__(self) -> None:
self.d: Data = 8.9
s = State[int]()
When I remove the (completely redundant, right?) -> None
part from the ctor, mypy
ignores the type mismatch. Why is that? (note that this is not a duplicate of this)