-
Notifications
You must be signed in to change notification settings - Fork 52
Open
Description
I'd like to be able to check whether I can index into a DimArray. With most AbstractArrays this can be done with Base.checkbounds, but there isn't an overload for DimArray that accepts keyword arguments. Should there be one? (And if not, what's the best way for me to check whether I can index in?)
julia> x = DimArray(rand(2, 3), (:a, :b))
┌ 2×3 DimArray{Float64, 2} ┐
├──────────────────── dims ┤
↓ a, → b
└──────────────────────────┘
0.737598 0.621954 0.0407873
0.303194 0.466593 0.763799
julia> x[a=1]
┌ 3-element DimArray{Float64, 1} ┐
├────────────────────────── dims ┤
↓ b
└────────────────────────────────┘
0.737598
0.621954
0.0407873
julia> checkbounds(Bool, x; a=1)
ERROR: MethodError: no method matching checkbounds(::Type{…}, ::DimMatrix{…}; a::Int64)
This method may not support any kwargs.Metadata
Metadata
Assignees
Labels
No labels