-
-
Notifications
You must be signed in to change notification settings - Fork 5.5k
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
2.0: make Bool !<: Integer? #50128
Comments
What kind of confusion does it lead to? |
For example, in indexing, the basic property that julia> let ix1 = [true, true]
ix2 = [1, 1]
v = [10, 20]
ix1 == ix2, v[ix1] == v[ix2]
end
(true, false) This example is also due to the unfortunate type-based overloading of It also behaves differently from all the other built-in integers - it widens rather than wrapping: julia> typemax(Int) + 1
-9223372036854775808
julia> typemax(Bool) + 1
2
|
Fixing |
I've reopened this because I do think it's worth considering for 2.0 whether |
I just meant to write |
I find
(1, 0) == (true, false)
causes confusion. I think it would be clearer and less bug-prone without this feature.It would be good to list use cases for the current behavior and find good replacements for them.
sum(bools)
could becount(bools)
mean(bools)
could bemean(float, bools)
The text was updated successfully, but these errors were encountered: