Closed louis-van-der-stam closed 2 years ago
https://mypy-play.net/?mypy=latest&python=3.10&flags=strict&gist=a7b2df2dd3bd46aced211191762a8075
Mypy already performs these checks š.
The annoying thing about mypy is that so many options are hidden and non-obvious. š
Thatās really great! Is this under control of some configuration flag? For me this obviously does not happenā¦.
Sure, strict = true
, but more specifically it's strict_equality = true
https://mypy.readthedocs.io/en/stable/config_file.html#confval-strict_equality
Thanks didn't expect this to be disabled by default. Will check the other options also!
Thanks for pointing it out!
I would also recommend enabled_error_codes = "truthy-bool, redundant-expr"
@louis-van-der-stam There is a fork of mypy called basedmypy, where these options are all enabled by default.
Some of these strictness options aren't enabled by default because they can (or at least used to) generate false positives in some cases. Strict equality is mature enough now that we could consider enabling it by default.
Feature
Pitch
It would be really nice if these basic comparison operators would be capable of detecting these kinds of errors.