hash()
Returns the integer hash used by dicts and sets; only immutable (hashable) objects have one.
Easy
hash("abc") works; hash([1, 2]) raises TypeError. String hashes are randomised per process for security.
Spotted a mistake or want to add detail? Suggest an improvement — Content Contributors' edits are reviewed by editors before they go live.
Discussion (0)
Sign in or join free to ask questions and discuss this topic.