Skip to content
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

Support @final (PEP 591) #161

Open
JelleZijlstra opened this issue May 2, 2021 · 1 comment
Open

Support @final (PEP 591) #161

JelleZijlstra opened this issue May 2, 2021 · 1 comment

Comments

@JelleZijlstra
Copy link
Contributor

Classes annotated with @final should not allow subclasses, and methods decorated with @final should not allow overrides.

@JelleZijlstra
Copy link
Contributor Author

This is impossible because the @final decorator is a no-op at runtime: https://github.com/python/cpython/blob/main/Lib/typing.py#L2030. I'm thinking of proposing a change to CPython for 3.11 to make the decorator add .__final__ = True to decorated functions or classes. Then we can backport that change to typing-extensions.

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