-
-
Notifications
You must be signed in to change notification settings - Fork 31.4k
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
[3.10] bpo-46769: Improve documentation for typing.TypeVar
(GH-31712)
#31941
Conversation
typing.TypeVar
(GH-31712)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks, good call on the additional example
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good! (Also cc @rhettinger since we're mentioning him in these docs.)
Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Sorry, @AlexWaygood and @JelleZijlstra, I could not cleanly backport this to |
…ythonGH-31712) (pythonGH-31941) * [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (pythonGH-31712) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 81b425d) * Remove references to `reveal_type`, add new section on `self` types. (cherry picked from commit d5ed8a8) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
GH-32067 is a backport of this pull request to the 3.9 branch. |
GH-31941) (GH-32067) * [3.9] [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712) (GH-31941) * [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (GH-31712) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 81b425d) * Remove references to `reveal_type`, add new section on `self` types. (cherry picked from commit d5ed8a8) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> * remove unused susp allowlist Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
…-31712) (pythonGH-31941) (pythonGH-32067) * [3.9] [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (pythonGH-31712) (pythonGH-31941) * [3.10] bpo-46769: Improve documentation for `typing.TypeVar` (pythonGH-31712) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com> (cherry picked from commit 81b425d) * Remove references to `reveal_type`, add new section on `self` types. (cherry picked from commit d5ed8a8) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com> * remove unused susp allowlist Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Co-authored-by: Jelle Zijlstra jelle.zijlstra@gmail.com
(cherry picked from commit 81b425d)
This PR backports GH-31712 to 3.10. However, two key modifications have been made:
reveal_type
(new in 3.11) have been removed.TypeVar
s to annotate alternative-constructor classmethods, has been added. This is one of the most important uses of boundTypeVar
s for Python versions <=3.10, but is no longer needed in 3.11 due to the addition oftyping.Self
.https://bugs.python.org/issue46769