-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
Calling __init__ explicitly is a valid (albeit uncommon) pattern, for example after calling explicitly __new__; however mypy considers it an error:
from __future__ import annotations
class Foo:
def __init__(self, a: int):
self.a = a
class Bar(Foo):
def __new__(cls, a: int) -> Bar:
self = super().__new__(cls)
# ....
self.__init__(a)
# ....
return self
if __name__ == '__main__':
print(Bar(1))