basedmypy
basedmypy copied to clipboard
make descriptors typesafe
class A:
pass
class D(A):
def __get__(a, b, c): return None # no error
class C:
d: A = D()
reveal_type(A.d) # A, at runtime it will be None
But you should still be able to return something different if you aren't subtyping another class:
class A:
def __get__(a, b, c): return None
class C:
a = A()
reveal_type(C.a) # None
This would mean that FunctionType would not extend Callable,
- see #614