Skip to content

Simplify the implementation of typing.Annotated #105509

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

Closed
AlexWaygood opened this issue Jun 8, 2023 · 0 comments · Fixed by #105510
Closed

Simplify the implementation of typing.Annotated #105509

AlexWaygood opened this issue Jun 8, 2023 · 0 comments · Fixed by #105510
Assignees
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-typing type-feature A feature request or enhancement

Comments

@AlexWaygood
Copy link
Member

AlexWaygood commented Jun 8, 2023

Feature or enhancement

typing.Annotated is currently implemented as a class, but doesn't need to be. All other objects like it in the typing module are implemented as instances of typing._SpecialForm, and we can do the same here. This simplifies the code a lot (making it easier to maintain in the future), and should also be slightly more performant.

Linked PRs

@AlexWaygood AlexWaygood added type-feature A feature request or enhancement topic-typing labels Jun 8, 2023
@AlexWaygood AlexWaygood self-assigned this Jun 8, 2023
@AlexWaygood AlexWaygood added stdlib Python modules in the Lib dir 3.13 bugs and security fixes labels Jun 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.13 bugs and security fixes stdlib Python modules in the Lib dir topic-typing type-feature A feature request or enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant