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

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

Merged

Conversation

@AlexWaygood AlexWaygood marked this pull request as ready for review April 7, 2023 14:30
@AlexWaygood AlexWaygood added the 3.12 bugs and security fixes label Apr 7, 2023
Doc/library/typing.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@hauntsaninja hauntsaninja left a comment

Choose a reason for hiding this comment

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

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 :-)

@AlexWaygood
Copy link
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 AlexWaygood merged commit 6441365 into python:main Apr 7, 2023
10 checks passed
@AlexWaygood 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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
3.12 bugs and 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