basedmypy
basedmypy copied to clipboard
Make constructors safe
class A:
def __init__(self): ...
class B:
def __init__(self, i: int): ...
a: type[A] = B
a() # no error
This is absurd
What if we removed the constructor from type and put into Init[A] or something?
- Upstream https://github.com/python/mypy/issues/1831
Additionally:
class A:
def __init__(self):
super().__init__(self, 1, 2, 3) # no error
Introduce a Class type that doesn't allow construction and make type safe and constructable.