Improve docs for typing.TypeAlias#105372
Merged
JelleZijlstra merged 6 commits intopython:mainfrom Jun 7, 2023
Merged
Conversation
AlexWaygood
commented
Jun 6, 2023
Member
Author
AlexWaygood
commented
Jun 7, 2023
Contributor
|
Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
Contributor
|
Sorry, @AlexWaygood and @JelleZijlstra, I could not cleanly backport this to |
miss-islington
pushed a commit
to miss-islington/cpython
that referenced
this pull request
Jun 7, 2023
(cherry picked from commit c5ec51e) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
GH-105446 is a backport of this pull request to the 3.12 branch. |
Member
|
I'll do the 3.11 backport |
JelleZijlstra
pushed a commit
to JelleZijlstra/cpython
that referenced
this pull request
Jun 7, 2023
(cherry picked from commit c5ec51e) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
|
GH-105447 is a backport of this pull request to the 3.11 branch. |
JelleZijlstra
added a commit
that referenced
this pull request
Jun 7, 2023
(cherry picked from commit c5ec51e) 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.
The current docs for
typing.TypeAliasare pretty bare on what the advantages are for doing this:Compared to this:
I've added a motivating example in this PR.
While
typing.TypeAliasis now deprecated following PEP-695, I think it's still worth improving the docs here. Lots of users won't be able to use the new syntax for a while, since it can't be backported to Python <3.12, and many users will want to continue supporting older Python versions for a while to come. Moreover, the fact thattyping.TypeAliasType(the new mechanism introduce by PEP-695) has such a similar name is pretty confusing, in my opinion. It reinforces the need for us to have good documentation for both the new and the old symbol.📚 Documentation preview 📚: https://cpython-previews--105372.org.readthedocs.build/