[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Documentation of __hash__

On 02/11/2020 02:23 AM, klauck2 at wrote:
> On Friday, February 7, 2020 at 4:30:23 PM UTC+1, Random832 wrote:

>> The purpose of this rule is to save you from having to override the default __hash__ with something that will only raise an exception when you do not intend your class to be hashable.
> If I do not intend my class to be hashable, I will set __hash__ to None (according to the documentation).

If you define your own __eq__ method, __hash__ is automatically set to None.