Closed blegat closed 3 years ago
The current approach seems to construct a Set so that it's fast to check whether an element is a key of the dictionary. This seems useless because:
Set
haskey(a, b)
b in keys(a)
c::Set{T}
a::Dict{T,Nothing}
b in c
So this is building a second dictionary with exactly the same keys to do haskey. Clearly it's best not to do that.
haskey
The current approach seems to construct a
Set
so that it's fast to check whether an element is a key of the dictionary. This seems useless because:haskey(a, b)
is the same asb in keys(a)
c::Set{T}
is aa::Dict{T,Nothing}
in which caseb in c
is simplyb in keys(a)
So this is building a second dictionary with exactly the same keys to do
haskey
. Clearly it's best not to do that.