Craig Coleman <craig.s.r.cole...@gmail.com> added the comment:

>From  https://docs.python.org/3/reference/datamodel.html#object.__hash__

User-defined classes have __eq__() and __hash__() methods by default; 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).

It doesn't work like that for tuples, NamedTuples nor dataclasses because their 
behaviour isn't expected to be a "user-defined class".

----------

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46739>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to