The size function works as expected for pairs(::Array), but throws an error for pairs(::NamedTuple). Is it expected or a bug? Shouldn’t the functions on Pairs work uniformly for all underlying containers?
If it is a bug, how can I open an issue?
julia> VERSION
v"1.5.0-DEV.338"
julia> A = [1, 2, 3]
3-element Array{Int64,1}:
1
2
3
julia> d = pairs(A)
pairs(::Array{Int64,1}) with 3 entries:
1 => 1
2 => 2
3 => 3
julia> size(d)
(3,)
julia> A = (a=1, b=2, c=3)
(a = 1, b = 2, c = 3)
julia> d = pairs(A)
pairs(::NamedTuple) with 3 entries:
:a => 1
:b => 2
:c => 3
julia> size(d)
ERROR: MethodError: no method matching size(::Tuple{Symbol,Symbol,Symbol})
Closest candidates are:
size(::Tuple, ::Integer) at tuple.jl:22
size(::BitArray{1}) at bitarray.jl:99
size(::BitArray{1}, ::Integer) at bitarray.jl:103
...
Stacktrace:
[1] size(::Base.Iterators.Pairs{Symbol,Int64,Tuple{Symbol,Symbol,Symbol},NamedTuple{(:a, :b, :c),Tuple{Int64,Int64,Int64}}}) at ./iterators.jl:232
[2] top-level scope at REPL[154]:1