Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 37)
37.
In Python, what is the purpose of the __hash__() method in a class?
To define class attributes
To create a new instance of the class
To customize the hash value for instances of the class
To access superclass attributes directly
Answer: Option
Explanation:
The __hash__() method is used to customize the hash value for instances of a class when using them in hashable collections like dictionaries or sets.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.