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

Improve protocols documentation #14577

Merged
merged 3 commits into from
Feb 2, 2023
Merged

Conversation

hauntsaninja
Copy link
Collaborator

Linking #13681

:py:func:`isinstance` with protocols is not completely safe at runtime.
For example, signatures of methods are not checked. The runtime
implementation only checks that all protocol members are defined.
implementation only checks that all protocol members exist,
Copy link
Member

Choose a reason for hiding this comment

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

It also doesn't check attributes at all, only methods, if I recall correctly. That might be worth mentioning.

Copy link
Member

@ilevkivskyi ilevkivskyi Feb 2, 2023

Choose a reason for hiding this comment

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

isinstance() checks both, but issubclass() checks only methods.

hauntsaninja and others added 2 commits February 2, 2023 12:09
Co-authored-by: Jelle Zijlstra <jelle.zijlstra@gmail.com>
@hauntsaninja hauntsaninja merged commit 7bde0d6 into python:master Feb 2, 2023
@hauntsaninja hauntsaninja deleted the docs3 branch February 2, 2023 20:43
hauntsaninja added a commit that referenced this pull request Feb 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants