-
Notifications
You must be signed in to change notification settings - Fork 40
Open
Description
Hello,
This is a very nice package.
What would prevent us to add an array interface to redered dicts by doing this
Base.getindex(OD::OrderedDict{K,V}, i::Int) where {K,V} = Base.getindex(OD.vals, i)
Base.getindex(OD::OrderedDict{K,V}, I::UnitRange{T}) where {K,V,T<:Real} = Base.getindex(OD.vals, I)
Base.getindex(OD::OrderedDict{K,V}, I::AbstractRange{T}) where {K,V,T} = Base.getindex(OD.vals, I)
Base.getindex(OD::OrderedDict{K,V}, c::Colon) where {K,V} = Base.getindex(OD.vals, c)
Base.firstindex(OD::OrderedDict{K,V}) where {K,V} = Base.firstindex(OD.vals)
Base.lastindex(OD::OrderedDict{K,V}) where {K,V} = Base.lastindex(OD.vals)
so that OD[1], OD[begin:end], and OD[1:2:end] would work ?
Best,
Amaël
Metadata
Metadata
Assignees
Labels
No labels