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.
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_attrstwice in_ProtocolMeta.__instancecheck__#103141typing._get_protocol_attrs#103152_ProtocolMeta.__instancecheck__#103159_get_protocol_attrsand_callable_members_onlyat protocol class creation time, not duringisinstance()checks #103160typing._ProtocolMeta.__instancecheck__#103280inspect.getattr_static#103195inspect.getattr_static#103318inspect._is_type#103321