Skip to content

Proposal: Dict constructors from tuples #4871

Closed
@kmsquire

Description

Just putting out feelers: I'd like to propose:

  • removing constructing Dicts from tuples as is currently done

    Dict{K,V}(ks::(K...), vs::(V...)) = Dict{K ,V }(ks, vs)
    Dict{K }(ks::(K...), vs::Tuple ) = Dict{K ,Any}(ks, vs)
    Dict{V }(ks::Tuple , vs::(V...)) = Dict{Any,V }(ks, vs)
    

    (from https://github.com/JuliaLang/julia/blob/master/base/dict.jl#L302)

  • add a dict constructor from a list of tuple pairs (as the inverse of collect on a Dict)

Item 1 seems like a vestige from before we had literal dict construction--is this used anywhere?

Item 2 seems like an oversight.

Metadata

Assignees

No one assigned

    Labels

    breakingThis change will break code

    Type

    No type

    Projects

    No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions