Python Programming - Inheritance - Discussion

Discussion Forum : Inheritance - General Questions (Q.No. 105)
105.
What is the purpose of the __slots__ attribute in Python classes?
To define class attributes
To create a new instance of the class
To restrict the set of attributes that can be assigned to instances
To access superclass attributes directly
Answer: Option
Explanation:
The __slots__ attribute is used to restrict the set of attributes that can be assigned to instances, providing memory optimization.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.