-
-
Notifications
You must be signed in to change notification settings - Fork 30.5k
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
gh-74690: Document changes made to runtime-checkable protocols in 3.12 #103348
Conversation
Misc/NEWS.d/next/Library/2023-04-07-15-09-26.gh-issue-74690.0f886b.rst
Outdated
Show resolved
Hide resolved
Misc/NEWS.d/next/Library/2023-04-07-15-09-26.gh-issue-74690.0f886b.rst
Outdated
Show resolved
Hide resolved
There was a problem hiding this 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 :-)
Well, only ~15x slower in 3.12 for simple protocols ;)
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 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 :-) |
…in 3.12 (python#103348) Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
Adds docs, NEWS and WhatsNew entries for changes made in these PRs:
_get_protocol_attrs
twice in_ProtocolMeta.__instancecheck__
#103141typing._get_protocol_attrs
#103152_ProtocolMeta.__instancecheck__
#103159_get_protocol_attrs
and_callable_members_only
at protocol class creation time, not duringisinstance()
checks #103160typing._ProtocolMeta.__instancecheck__
#103280inspect.getattr_static
#103195inspect.getattr_static
#103318inspect._is_type
#103321