The signature of Logger.getChild is
def getChild(self, suffix: str) -> Logger: ...
However, this fails if one subclasses Logger, e.g. the following code
logger = MyLogger(...)
child: MyLogger = logger.getChild(...)
Raises type[assignment] error (expression has type "Logger", variable has type "MyLogger"). The signature should be
def getChild(self: T, suffix: str) -> T: ...
where T = TypeVar('T', bound=Logger). Cf. python/mypy#1212 and python/typing#980
The signature of
Logger.getChildisHowever, this fails if one subclasses
Logger, e.g. the following codeRaises
type[assignment]error (expression has type "Logger", variable has type "MyLogger"). The signature should bewhere
T = TypeVar('T', bound=Logger). Cf. python/mypy#1212 and python/typing#980