Guido van Rossum <gu...@python.org> added the comment:

Sorry, I used imprecise language. What you propose is fine.

On Feb 24, 2018 09:54, "Eric V. Smith" <rep...@bugs.python.org> wrote:

>
> Eric V. Smith <e...@trueblade.com> added the comment:
>
> Note that this class (from the test suite) will now raise an exception:
>
>         @dataclass(unsafe_hash=True)
>         class C:
>             i: int
>             def __eq__(self, other):
>                 return self.i == other.i
>
> That's because it has a __hash__, added when __eq__ is defined. I think
> we're better off with the rule being:
>
> If unsafe_hash=True, raise an exception if __hash__ exists and is not
> None. Otherwise add __hash__.
>
> That's how it used to be with hash=True (in 3.70b1).
>
> Or is that what you meant by "but if a __hash__ method is present, an
> exception is raised"? Notice the word "method", instead of attribute.
>
> ----------
>
> _______________________________________
> Python tracker <rep...@bugs.python.org>
> <https://bugs.python.org/issue32929>
> _______________________________________
>

----------

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

Reply via email to