← 返回首页
gh-74690: Document changes made to runtime-checkable protocols in 3.12 by AlexWaygood · Pull Request #103348 · python/cpython · GitHub
Skip to content

Navigation Menu

Toggle navigation
Sign in
Appearance settings
Search or jump to...

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Include my email address so I can be contacted

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
Resetting focus

gh-74690: Document changes made to runtime-checkable protocols in 3.12#103348

Merged
AlexWaygood merged 8 commits into
python:mainfrom
AlexWaygood:document-runtime-protocol-changes
Apr 7, 2023
Merged

gh-74690: Document changes made to runtime-checkable protocols in 3.12#103348
AlexWaygood merged 8 commits into
python:mainfrom
AlexWaygood:document-runtime-protocol-changes

Conversation

AlexWaygood marked this pull request as ready for review April 7, 2023 14:30
AlexWaygood added the 3.12 only security fixes label Apr 7, 2023
Comment thread Doc/library/typing.rst Outdated Show resolved Hide resolved
Comment thread Misc/NEWS.d/next/Library/2023-04-07-15-09-26.gh-issue-74690.0f886b.rst Outdated Show resolved Hide resolved
Comment thread Misc/NEWS.d/next/Library/2023-04-07-15-09-26.gh-issue-74690.0f886b.rst Outdated Show resolved Hide resolved

hauntsaninja left a comment
edited
Loading

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality Hide comment

The changes look good. Only thing I'm thinking of is that most users reading What's New still don't have the context that runtime_checkable isinstance is like 400x slower than regular isinstance or whatever. Feels hard to communicate "this thing is 20x faster than it was, but is still 20x slower than you might think it is", but maybe there's a good way :-)

Copy link
Copy Markdown
Member Author

Only thing I'm thinking of is that most users reading What's New still don't have the context that runtime_checkable isinstance is like 400x slower than regular isinstance or whatever.

Well, only ~15x slower in 3.12 for simple protocols ;)

Feels hard to communicate "this thing is 20x faster than it was, but is still 20x slower than you might think it is"

Yeah... I know what you mean. I feel pretty torn. On the one hand, I agree that this is important context. On the other hand, I feel like this is pretty clearly documented in typing.rst now; that the performance improvement is worth celebrating on its own; and that "What's new" should be primarily focussed on the difference between the Python versions.

I think I'll leave this as it is for now, but happy to accept improvements in followup PRs if we can think of a better way of phrasing it :-)

AlexWaygood merged commit 6441365 into python:main Apr 7, 2023
AlexWaygood deleted the document-runtime-protocol-changes branch April 7, 2023 21:06
warsaw pushed a commit to warsaw/cpython that referenced this pull request Apr 11, 2023
…in 3.12 (python#103348) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@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

Labels

3.12 only security fixes docs Documentation in the Doc dir topic-typing

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Performance of typing._ProtocolMeta._get_protocol_attrs and isinstance

6 participants

Footer

© 2026 GitHub, Inc.