addall(::AbstractDict, ::AbstractDict)

Hey All :slight_smile:

First of all. Is there a addall(::AbstractDict, ::AbstractDict) function? I didn’t find one.
My work around was:

push!(copy_to_dict, copy_from_dict...)

But now the problem is that if length(copy_from_dict) == 0 the code above throws an error.

julia> d = Dict()
Dict{Any, Any}()

julia> push!(d, Dict()...)
ERROR: MethodError: no method matching push!(::Dict{Any, Any})
Closest candidates are:
  push!(::AbstractDict, ::Pair) at abstractdict.jl:515
  push!(::AbstractDict, ::Pair, ::Pair) at abstractdict.jl:516
  push!(::AbstractDict, ::Pair, ::Pair, ::Pair...) at abstractdict.jl:517

Should I open an issue to add push!(::AbstractDict) and/or to add addall!

I think merge! already does this:

help?> merge!
search: merge! mergewith! merge mergewith MergeSort

  merge!(d::AbstractDict, others::AbstractDict...)

  Update collection with pairs from the other collections. See also merge.

  Examples
  ≡≡≡≡≡≡≡≡≡≡

  julia> d1 = Dict(1 => 2, 3 => 4);

  julia> d2 = Dict(1 => 4, 4 => 5);

  julia> merge!(d1, d2);

  julia> d1
  Dict{Int64, Int64} with 3 entries:
    4 => 5
    3 => 4
    1 => 4
3 Likes