hash(object)
The hash function returns the hash value of the object passed as a argument -if any-. Hash values are integers. Numeric values that, when compared, return True have the same associated hash value, even if they are of different type.
The hash function returns an integer.
The hash value of any number with no decimal part (be it integer, real, or complex) matches the number itself (interpreted as an integer). The booleans True and False values are interpreted as 1 and 0, respectively:
The hash of a couple of text strings is calculated in this example:
The tuples have a hash value associated with them. In contrast, a mutable object like a list doesn't: