-
-
Notifications
You must be signed in to change notification settings - Fork 2.9k
[truthy-function] does not work with @cache #17013
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
This is closely related to python/typeshed#11280 but could perhaps be fixed in mypy independently. If you add a |
@JelleZijlstra possibly consider any callable? Yes, incorrect in general, but correct in practice. Or, better, maybe check anything that does not have explicit I think, any case of usage of an object in a condition without defined conversion to bool is a bug. |
Yes, a generalization could make sense. I implemented something like that in pyanalyze and it's been useful, but it's not a simple change to make. |
I think mypy already supports that, just is disabled by default: https://mypy.readthedocs.io/en/stable/error_code_list2.html#check-that-expression-is-not-implicitly-true-in-boolean-context-truthy-bool |
Closing per my previous comment. If you want to test it in mypy-play.net, you can use an inline comment at the top of the file like |
All messages:
The text was updated successfully, but these errors were encountered: