-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
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
Use assert
s instead of cast
s where possible
#14860
Conversation
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Split off from python#14860, since this one is a no-brainer
Split off from #14860, since this one is a no-brainer. `args[0]` has just been narrowed to be of type `StrExpr` in the lines immediately above, and `args` is the same as `call.args`.
Moving this back into draft: looking at this again, I think you're right; we can fairly easily improve the signature of |
This comment has been minimized.
This comment has been minimized.
Here's a better solution for the |
According to mypy_primer, this change has no effect on the checked open source code. 🤖🎉 |
There are many places in mypy's code where
cast
s are currently used unnecessarily. These can be replaced withassert
s, which are much more type-safe, and more mypyc-friendly.