-
-
Notifications
You must be signed in to change notification settings - Fork 32k
Document Annotated.__origin__
#124120
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
Comments
You should not use this directly, but use |
Actually, looking at the code some more this is not true. For some reason there is a special case where
This aligns with the documentation, which promises that for Since |
I made this mistake in the first version of #124125 But, then I realized the same thing as in #124120 (comment) Why? Because of these two lines: Lines 2507 to 2508 in 9aa1f60
I think that it makes sense:
So, |
Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit faef3fa) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
(cherry picked from commit faef3fa) Co-authored-by: sobolevn <mail@sobolevn.me> Co-authored-by: Brian Schubert <brianm.schubert@gmail.com> Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Backports have been merged, so marking this as complete. Thanks, folks! |
Uh oh!
There was an error while loading. Please reload this page.
The
typing
module docs cover usingAnnotated.__metadata__
to retrieve the annotations, but they do not currently cover the use ofAnnotated.__origin__
to retrieve the underlying type hint that is being annotated.Linked PRs
Annotated.__origin__
#124125Annotated.__origin__
(GH-124125) #124416Annotated.__origin__
(GH-124125) #124417The text was updated successfully, but these errors were encountered: