go-python / go-python/gpython

Implement dict to receive Object as key, not only String

未关闭
#118 10 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看
主要语言
Go
星标
1k
派生
105
PR 合并指标
30 天内没有已合并 PR

描述

https://github.com/go-python/gpython/blob/33327c5231b03c84972bec57262694aebbaa1e84/py/dict.go#L68

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.
```go
make([]Object, 0, len(default_size)) // slice to store object (index -> Object)
type Dict map[HashIndex]int // map to store index of slice (Hash -> index)
```

Is it ok to implement dict this way?

贡献指南

这个仓库没有索引到贡献指南

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。