-
-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
np.bool_
and bool
are incompatible
#10385
Comments
👍 Would be good to have a fix for this! |
I think that you could maybe make a mypy plugin, but otherwise I'm not sure if there is much to be done here. A |
What exactly is your use case for treating |
I can't answer for the original poster but yes I agree with this. I think I was imagining a parent class for both For context, the issue arose for me when upgrading |
While I don't think Perhaps something that similar to the |
There is no |
No, you're right here actually. Somehow I must have misremembered |
Bug Report
From numpy/numpy#18876:
Reproducing code example:
yields
The same happens for the inverse:
results in
np.float_
andnp.int_
work fine.As @BvB93 points out, this is not an issue that numpy can fix, as python does not allow creating subclasses of
bool
:Is there a possibility to fix this within mypy? E.g. by adding a new
Bool
orBoolLike
type that allows for comparisons. numpy could then possibly createnp.bool_
as a subclass ofBool
.The text was updated successfully, but these errors were encountered: