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

Document NewType.__supertype__ #104874

Closed
JelleZijlstra opened this issue May 24, 2023 · 0 comments · Fixed by #104875
Closed

Document NewType.__supertype__ #104874

JelleZijlstra opened this issue May 24, 2023 · 0 comments · Fixed by #104875
Labels
docs Documentation in the Doc dir topic-typing

Comments

@JelleZijlstra
Copy link
Member

JelleZijlstra commented May 24, 2023

typing.NewType has always had an attribute __supertype__ pointing to its supertype. It is widely used in the wild (e.g. https://github.com/pydantic/pydantic/blob/00158878cb1c6218cd58ee62248db56c65e4172c/pydantic/_internal/_typing_extra.py#L153, https://github.com/quora/pyanalyze/blob/bd7f520adc2d8b098be657dfa514d1433bea3b0c/pyanalyze/annotations.py#L456), but not documented. Let's document it and commit to leaving it stable.

Linked PRs

@JelleZijlstra JelleZijlstra added docs Documentation in the Doc dir topic-typing labels May 24, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 24, 2023
(cherry picked from commit 41768a2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
miss-islington pushed a commit to miss-islington/cpython that referenced this issue May 24, 2023
(cherry picked from commit 41768a2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood pushed a commit that referenced this issue May 24, 2023
gh-104874: Document NewType.__supertype__ (GH-104875)
(cherry picked from commit 41768a2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
AlexWaygood pushed a commit that referenced this issue May 24, 2023
gh-104874: Document NewType.__supertype__ (GH-104875)
(cherry picked from commit 41768a2)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir topic-typing
Projects
None yet
Development

Successfully merging a pull request may close this issue.

1 participant