Skip to content

make descriptors typesafe #617

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
KotlinIsland opened this issue Jan 13, 2024 · 0 comments
Open

make descriptors typesafe #617

KotlinIsland opened this issue Jan 13, 2024 · 0 comments

Comments

@KotlinIsland
Copy link
Owner

KotlinIsland commented Jan 13, 2024

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,

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant