-
-
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
Optional "no truth value testing" mode #1730
Comments
This would be technically pretty easy to implement, perhaps you'd like to give it a shot? I tend to be a fan of the "conditions must be |
Yes, I'd like to give it a shot. I expect to have some free time in early July. Once I know roughly what changes I want to make, I will outline them here to see if they make sense. Thanks! |
@tigrfhluerh are you still planning on working on this? If not, I'd be happy to do it. |
Sorry for hijacking this issue, but does using flag lead to good style or not? After all it goes against PEP 8, e.g.:
|
I personally see no value in enforcing this, but apparently some people do.
Style can be a personal choice. The option will always remain off by
default. (Hm, should `--strict` turn it on? I hope not, it would make
`--strict` much more annoying.)
|
(Sadly it is.)
|
|
Yeah, so IMO it's useless. Maybe we should get rid of it. |
We seem to have several enthusiastic users of |
We're considering killing this option, as it complicates maintenance and it's an unpythonic requirement. See discussion in #3185. |
Feature request:
Make it possible to tell mypy to treat the following as errors:
(This list is based on the "Truth Value Testing" section in https://docs.python.org/3/library/stdtypes.html)
The goal is to force the developer to use explicit coercions like:
Of course libraries and stubs should not be affected by this restriction.
The rationale is that while truth value testing is a valuable shortcut for many people, it also causes bugs, so some projects might want to force their developers to use explicit coercions.
The text was updated successfully, but these errors were encountered: