Python Equality and Hashing
Python distinguishes identity (is) from value equality (==). Objects used as dictionary keys or set members must have a stable hash consistent with equality for as long as they are stored in those collections.
Value equality, object identity, and hash-based collection contracts.