go-python / go-python/gpython

Implement dict to receive Object as key, not only String

Ouverte
#118 10 commentaires 0 réactions 0 personnes assignées Voir sur GitHub
Langage dominant
Go
Étoiles
1k
Forks
105
Métriques de merge des PR
Aucune PR mergée en 30 j

Description

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?

Guide de contribution

Aucun guide de contribution indexé pour ce dépôt

Évaluation

Cette issue n'a pas encore été évaluée.

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.