Skip to content
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

Document PEP 698 and other new typing features in What's New #104957

Merged
merged 3 commits into from
May 28, 2023

Conversation

JelleZijlstra
Copy link
Member

@JelleZijlstra JelleZijlstra commented May 26, 2023

@JelleZijlstra JelleZijlstra changed the title Document PEP 698 in Whats New Document PEP 698 and other new typing features in What's New May 26, 2023
@JelleZijlstra
Copy link
Member Author

I looked over git diff 3.11 3.12 Lib/typing.py and noticed two more changes that deserve to be mentioned: @adriangb's work on __orig_bases__ and @debonte's addition of frozen_default.

Doc/whatsnew/3.12.rst Outdated Show resolved Hide resolved
@@ -755,6 +778,13 @@ typing
or more members may be slower than in Python 3.11. (Contributed by Alex
Waygood in :gh:`74690` and :gh:`103193`.)

* All :data:`typing.TypedDict` and :data:`typing.NamedTuple` classes now have the
``__orig_bases__`` attribute. (Contributed by Adrian Garcia Badaracco in
Copy link
Member

@AlexWaygood AlexWaygood May 26, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Given that this attribute is undocumented (and I'd prefer it to stay that way, though that's not a strong opinion), could we add this something like "this ensures that types.get_original_bases(typeddict_class) will now always return the correct result"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could say "now work reliably with :func:types.get_original_bases", although that's a bit of a vacuous statement as types.get_original_bases didn't exist before 3.12 :)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Eh, I guess you're right, it's probably fine as it is

Co-authored-by: Alex Waygood <Alex.Waygood@Gmail.com>
Copy link
Contributor

@stroxler stroxler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The PEP 698 section looks good to me, thanks!

@hauntsaninja hauntsaninja merged commit 595ffdd into python:main May 28, 2023
@miss-islington
Copy link
Contributor

Thanks @JelleZijlstra for the PR, and @hauntsaninja for merging it 🌮🎉.. I'm working now to backport this PR to: 3.12.
🐍🍒⛏🤖 I'm not a witch! I'm not a witch!

@bedevere-bot
Copy link

GH-105045 is a backport of this pull request to the 3.12 branch.

@bedevere-bot bedevere-bot removed the needs backport to 3.12 bug and security fixes label May 28, 2023
miss-islington pushed a commit to miss-islington/cpython that referenced this pull request May 28, 2023
…H-104957)

(cherry picked from commit 595ffdd)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
hauntsaninja pushed a commit that referenced this pull request May 28, 2023
…H-104957) (#105045)

Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>

from typing import override

class Base:

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 space tab would be more consistent.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Documentation in the Doc dir skip issue skip news
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants