diff --git a/base/namedtuple.jl b/base/namedtuple.jl index 67eaaa9efe941c..2377b67bf01fad 100644 --- a/base/namedtuple.jl +++ b/base/namedtuple.jl @@ -103,6 +103,8 @@ firstindex(t::NamedTuple) = 1 lastindex(t::NamedTuple) = nfields(t) getindex(t::NamedTuple, i::Int) = getfield(t, i) getindex(t::NamedTuple, i::Symbol) = getfield(t, i) +getindex(t::NamedTuple, v::AbstractVector{Symbol}) = [t[i] for i in v] +getindex(t::NamedTuple, i) = values(t)[i] indexed_iterate(t::NamedTuple, i::Int, state=1) = (getfield(t, i), i+1) isempty(::NamedTuple{()}) = true isempty(::NamedTuple) = false