DataStructures.jl
DataStructures.jl copied to clipboard
Is it intentional that setindex! does not work on MultiDict
Right now setindex! does not work on MultiDict which also means dict[1]=1 does not work. Is that intentional?
This looks like a bug to me. One should be able to write
multidict[1] = [1]
currently I don't see how to create a multidict with an empty list without monkey-patching
julia> md = MultiDict{Symbol, Int}()
julia> insert!(md, :a, 1)
julia> md.d[:b] = Int[] # monkey-patch
julia> md
MultiDict{Symbol, Int64}(Dict(:a => [1], :b => []))
julia> for (key, values) in md
for value in values
println(key, ' ', value)
end
end
a 1