-
-
Notifications
You must be signed in to change notification settings - Fork 1.8k
Mypy *sometimes* doesn't see metaclass-provided properties for protocols #6393
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
Comments
Wait, is this because the standard library's protocols themselves are lies? Why do (redundant?) definitions exist at all inside Taking note of some history here to partly explain how we got here….
|
mypy and other static type checkers don't look at CPython source code at all. typeshed doesn't even have This means that If you use the following I think you get the results you expect:
|
That's because you're a 17th level wizard specializing in typedivination. For the rest of us mere mortals, this is downright counterintuitive to say nothing of ergonomic. Why the inconsistent behavior among user-defined protocols and standard library ones? 😕 Or is that your point about "weirdness"? Thanks for the work-around, though! ❤️ |
It looks like a couple people are using this in the wild. Resolves python#6393
This is just weird. Somehow,
SupportsInt
and other standard librarySupports
protocols (and subclasses) are "special" when used in composing protocols. I do not know if this is related to (or the same root cause as) python/mypy#7945.The text was updated successfully, but these errors were encountered: