Skip to content

Apply the None rule only to callable protocol members. #3938

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

Closed
ilevkivskyi opened this issue Sep 9, 2017 · 0 comments
Closed

Apply the None rule only to callable protocol members. #3938

ilevkivskyi opened this issue Sep 9, 2017 · 0 comments
Assignees
Labels

Comments

@ilevkivskyi
Copy link
Member

Currently mypy applies the rule that things like __iter__ = None block protocol implementation. However, it is applied only to dunder attributes, which is too ad-hoc (also there are names like send and throw in collections.abc). It is proposed in python/typing#464 that it should be applied only to methods (callable members) which would be more consistent.

@ilevkivskyi ilevkivskyi self-assigned this Sep 9, 2017
gvanrossum pushed a commit that referenced this issue Sep 29, 2017
This updates protocol semantic according to the discussion in python/typing#464:

    None should be considered a subtype of an empty protocol
    method = None rule should apply only to callable protocol members
    issublcass() is prohibited for protocols with non-method members.

Fixes #3906
Fixes #3938
Fixes #3939
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant