[3.10] bpo-46769: Improve documentation for typing.TypeVar (GH-31712)#31941
Merged
Conversation
typing.TypeVar (GH-31712)
JelleZijlstra
left a comment
Member
There was a problem hiding this comment.
Thanks, good call on the additional example
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
JelleZijlstra
approved these changes
Mar 17, 2022
JelleZijlstra
left a comment
Member
There was a problem hiding this comment.
Looks good! (Also cc @rhettinger since we're mentioning him in these docs.)
Contributor
|
Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.9. |
Contributor
|
Sorry, @AlexWaygood and @JelleZijlstra, I could not cleanly backport this to |
JelleZijlstra
pushed a commit
to JelleZijlstra/cpython
that referenced
this pull request
Mar 23, 2022
…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. |
ambv
pushed a commit
that referenced
this pull request
Mar 23, 2022
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>
hello-adam
pushed a commit
to hello-adam/cpython
that referenced
this pull request
Jun 2, 2022
…-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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.TypeVars to annotate alternative-constructor classmethods, has been added. This is one of the most important uses of boundTypeVars for Python versions <=3.10, but is no longer needed in 3.11 due to the addition oftyping.Self.https://bugs.python.org/issue46769