What does hash do in python?

前端 未结 5 754
春和景丽
春和景丽 2020-11-28 01:31

I saw an example of code that where hash function is applied to a tuple. As a result it returns a negative integer. I wonder what does this function do? Google

5条回答
  •  佛祖请我去吃肉
    2020-11-28 02:05

    The hash is used by dictionaries and sets to quickly look up the object. A good starting point is Wikipedia's article on hash tables.

提交回复
热议问题