This article introduces the Python built-in hash function in detail.
English document:
Hash(Object) Return the hash value of the object (if it has one ). hash values are integers. they are used to quickly compare dictionary keys during a dictionary lookup. numeric values that compare equal have the same hash value (even if they are of different types, as is the case for 1 and 1.0 ).
Note:
1. return the hash value of the object, represented by an integer. Hash values can be used to quickly compare key values in dictionary search.
>>> Hash ('good good study ') 1032709256
2. equal values. even if the types are different, the calculated hash values are the same.
>>> 1.0 = 1 True >>> hash (1.0) >>> hash (1) >>> hash (1.0000)
The above is a detailed description of the Python built-in hash function. For more information, see other related articles in the first PHP community!