Author eric.smith
Recipients eric.smith, gvanrossum, ned.deily, steven.daprano
Date 2018-02-24.17:54:30
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1519494871.05.0.467229070634.issue32929@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-02-24 17:54:31eric.smithsetrecipients: + eric.smith, gvanrossum, ned.deily, steven.daprano
2018-02-24 17:54:31eric.smithsetmessageid: <1519494871.05.0.467229070634.issue32929@psf.upfronthosting.co.za>
2018-02-24 17:54:31eric.smithlinkissue32929 messages
2018-02-24 17:54:30eric.smithcreate