You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Implement dict to receive Object as key, not only String #118
Change the dict to receive a hashable object as a key, not just a string.
I will change it so that the object can be looked up through the hash value of the object.
Store the object in the slice and use the map to find the index of the stored object through the hash value.
make([]Object, 0, len(default_size)) // slice to store object (index -> Object)typeDictmap[HashIndex]int// map to store index of slice (Hash -> index)
@HyeockJinKim
However, as @sbinet commented.
I'd like to recommend you implement unordered key dictionary as the 1st milestone.
That will be enough for the 1st step.
Activity
corona10 commentedon Oct 14, 2019
@HyeockJinKim
I 'd like to recommend to implement dict by wrapping the map throw using the delegate pattern.
cc @ncw
corona10 commentedon Oct 14, 2019
cc @sbinet
sbinet commentedon Oct 14, 2019
if I am not mistaken,
CPythondicts are not ordered (there'scollections.OrderedDictfor that.)so, couldn't we just use
map[Object]Objectat the core of this data structure?corona10 commentedon Oct 14, 2019
@sbinet
FYI
He might want to implement this feature.
It is okay that we decide to broken 3.4 compatibilities.
(#74 (comment))
corona10 commentedon Oct 14, 2019
@HyeockJinKim
However, as @sbinet commented.
I'd like to recommend you implement unordered key dictionary as the 1st milestone.
That will be enough for the 1st step.
cc @ncw @sbinet
sbinet commentedon Oct 14, 2019
I stand corrected :)
ok, then what about:
(I think we can rely on Go's map hashing mechanism)
sbinet commentedon Oct 14, 2019
and if we want to retain insertion order:
ashermancinelli commentedon Oct 19, 2019
Does anyone have a fork for this issue? Would be willing to give it a shot.
corona10 commentedon Oct 19, 2019
@ashermancinelli please ping to @HyeockJinKim
He might work on this issue :)
HyeockJinKim commentedon Oct 19, 2019
I'm working on this issue right now.
I will work quickly and PR.
Implement dict to receive Object as key