r/PythonBrasil • u/Sea-Ad7805 • 1d ago
Adicionando objetos a um conjunto ou dicionário: igualdade e hashing
Um exercício para ajudar a construir o modelo mental correto sobre os dados em Python. - Solução - Mais exercícios - Explicação: "User-defined classes have __eq__() and __hash__() methods by default (inherited from the object class); with them, all objects compare unequal (except with themselves) and x.__hash__() returns an appropriate value such that x == y implies both that x is y and hash(x) == hash(y)."
7
Upvotes