What does “hashable” mean in Python?

后端 未结 9 876
挽巷
挽巷 2020-11-22 16:45

I tried searching internet but could not find the meaning of hashable.

When they say objects are hashable or hashable objects what does it

9条回答
  •  深忆病人
    2020-11-22 17:48

    For creating a hashing table from scratch, all the values has to set to "None" and modified once a requirement arises. Hashable objects refers to the modifiable datatypes(Dictionary,lists etc). Sets on the other hand cannot be reinitialized once assigned, so sets are non hashable. Whereas, The variant of set() -- frozenset() -- is hashable.

提交回复
热议问题