-
-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
Consider adding strict-bool
mode
#8363
Comments
Agree that this could be useful. For an amusing real life instance of this problem: psf/black#762 followed by psf/black#1092 |
this happens to me a lot, and I think this could be a more useful behaviour for a
Functions are not
|
Maybe instead of this, it should be more general, such as "type of foo is a Union such that some unioned types can be true and some can be false". This way, |
I think my previous two comments can be ignored. There's already |
Since we now support enabling individual error codes (#9172), this should be implemented as one or more optionally enabled error codes instead of a command-line flag such as We may want two separate error codes, since there are at least two separate issues that would be useful to catch:
Additionally, |
As it was discussed in #8069, sometimes we need to logically separate
int
andbool
types.Currently
mypy
allows this to happen:Because
bool
is subtype ofint
. I am proposing to add astrict-bool
mode, sobool
would be treated as a non-int type. And this code would generate an error.It can be a new config option:
--strict-bool
or a new disabled by default error code in the future as @JukkaL suggested.The text was updated successfully, but these errors were encountered: