Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:

> there are other such mutable objects in python which do define
> __hash__ = None such as list and dict

Those objects compare on their contents, not on object identity.

Take a look at how hashing works in dataclasses.  You can have a mix of mutable 
and immutable fields as long as both __eq__ and __hash__ depend on only the 
immutable fields.

Also, take a look at database cursor objects.  Both __eq__ and __hash__ use 
object identity even though fetchone() advances the internal state (just like 
an iterator).

Anyway, the breaking of existing working code makes this a non-starter.

----------

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

Reply via email to