Name

hash

Synopsis

hash(obj)

Returns the hash value for obj. obj can be a dictionary key only if obj can be hashed. All numbers that compare equal have the same hash value, even if they are of different types. If the type of obj does not define equality comparison, hash( obj ) returns id( obj ). See also __hash__ in Chapter 5.

Get Python in a Nutshell now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.