-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
typing: add _ProtocolMeta #6394
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
Conversation
It looks like a couple people are using this in the wild. Resolves python#6393
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.
+1, I use it quite a lot.
The first usecase I can remember and find: https://github.com/antonagestam/phantom-types/blob/main/src/phantom/sized.py#L27-L34
I guess we also need to add it to typing_extensions
then.
This comment has been minimized.
This comment has been minimized.
Okay, some notes: Btw, for whatever it's worth, it looks like that phantom types use case isn't really affected by the issue linked, since the metaclasses it's using don't have any attributes that contribute to the protocol. If it were to add attributes, it might still run into issues, because in general mypy doesn't understand |
This comment has been minimized.
This comment has been minimized.
1 similar comment
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
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.
No red flags in code, and the example code from related issue no longer errors.
It looks like a couple people are using this in the wild.
Resolves #6393