Consider adding `--non-numeric-bool` mode
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 20.6k
- Forks
- 3.3k
- PR merge metrics
- PR metrics pending
Description
As it was discussed in https://github.com/python/mypy/issues/8069, sometimes we need to logically separate int and bool types.
Currently mypy allows this to happen:
def some(a: int): ...
some(x > 1)
Because bool is subtype of int. I am proposing to add a strict-bool mode, so bool 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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the discussion in issue #8069 and the example showing bool passed to an int parameter. Determine the intended behavior and whether it should be a --strict-bool configuration option or a disabled error code. Done means the example is rejected when the feature is enabled while existing behavior remains unchanged by default.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- compilers, devtools
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100