There's Base.keytype and Base.valuetype. I think this may be a reasonable argument for making Tuple iterable. ( https://github.com/JuliaLang/julia/pull/10380#issuecomment-96837574)
On Sat, May 2, 2015 at 4:12 PM <[email protected]> wrote: > In 0.3 it was possible to get type of key and value as a tuple using > *eltype* function as follow > > julia> d = Dict{Char,Int}(['a','b'], [1,2]) > Dict{Char,Int64} with 2 entries: > 'b' => 2 > 'a' => 1 > > julia> K,V = eltype(d) > (Char,Int64) > > julia> K > Char > > After adding a *Tuple* type in 0.4, *eltype* returns tuple object > > julia> d = Dict{Char,Int}('a'=>1, 'b'=>2) > Dict{Char,Int64} with 2 entries: > 'b' => 2 > 'a' => 1 > > julia> eltype(d) > Tuple{Char,Int64} > > julia> K,V = eltype(d) > ERROR: MethodError: `start` has no method matching > start(::Type{Tuple{Char,Int64}}) > > Question is how do I get type of key or value separately? > >
