Construct Dict same as NamedTuple

Is there a reason that I’m currently not seeing against using this? mainly for the sake of laziness.

julia> Base.Dict(;kwargs...) = Dict(kwargs)

julia> Dict(a=1,b=2)
Dict{Symbol, Int64} with 2 entries:
  :a => 1
  :b => 2

Thanks

Because there already is

Dict(:a => 1, :b => 2)

which allows Dict to have actual keyword arguments.

1 Like