-
-
Notifications
You must be signed in to change notification settings - Fork 33.3k
Improve docs for typing.TypeAlias
#105372
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
Conversation
|
Thanks @AlexWaygood for the PR, and @JelleZijlstra for merging it 🌮🎉.. I'm working now to backport this PR to: 3.11, 3.12. |
|
Sorry, @AlexWaygood and @JelleZijlstra, I could not cleanly backport this to |
(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. |
|
I'll do the 3.11 backport |
(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. |
(cherry picked from commit c5ec51e) Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
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/