[Python-Dev] Dataclasses and correct hashability
Elvis Pranskevichus
elprans at gmail.com
Thu Feb 1 20:29:57 EST 2018
On Thursday, February 1, 2018 8:21:03 PM EST Eric V. Smith wrote:
> I should add: This is why you shouldn't override the default
> (hash=None) unless you know what the consequences are. Can I ask
> why you want to specify hash=True?
hash=None and compare=True leads to the same result, which, I think is
even worse.
> You're allowed to override the parameters to dataclasses.dataclass
> for cases where you know what you're doing. Consenting adults,
> and all.
I don't agree with this. You are comparing implicit dataclass
behavior with an explicit shoot-in-the-foot __hash__() definition.
Elvis
More information about the Python-Dev
mailing list