You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Boolean indexing of tuples doesn't check bounds, but boolean indexing of vectors does.
julia> (1,2,3)[[true, false]]
(1,)
julia> (1,2,3)[[true, true, false, false, false]]
(1,2)
julia> [1,2,3][[true, false]]
ERROR: BoundsError: attempt to access 3-element Array{Int64,1} at index [Bool[true,false]]
inthrow_boundserror(::Array{Int64,1}, ::Tuple{Array{Bool,1}}) at ./abstractarray.jl:355in checkbounds at ./abstractarray.jl:284 [inlined]
in _getindex at ./multidimensional.jl:270 [inlined]
ingetindex(::Array{Int64,1}, ::Array{Bool,1}) at ./abstractarray.jl:752
I can see a parallel with tuple assignment, so perhaps this was intentional? Is there an upside to allowing that? I could not find any discussion of it.
The text was updated successfully, but these errors were encountered:
Also deprecate indexing tuples by non-vectors since that should increase the
dimensionality of the tuple, but tuples are 1-d only structures.
FixJuliaLang#19719
* Check bounds for indexing tuples by logical masks
Also deprecate indexing tuples by non-vectors since that should increase the
dimensionality of the tuple, but tuples are 1-d only structures.
Fix#19719
* Don't use the AbstractVector typealias
Boolean indexing of tuples doesn't check bounds, but boolean indexing of vectors does.
I can see a parallel with tuple assignment, so perhaps this was intentional? Is there an upside to allowing that? I could not find any discussion of it.
The text was updated successfully, but these errors were encountered: