Python Programming - Functions - Discussion

Discussion Forum : Functions - General Questions (Q.No. 67)
67.
What does the __slots__ attribute do in a Python class?
It specifies the slots where the class instances are stored.
It restricts the creation of new attributes in class instances.
It defines the initial values of attributes in class instances.
It allows for dynamic creation of attributes in class instances.
Answer: Option
Explanation:
The __slots__ attribute in Python is used to restrict the creation of new attributes in class instances.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.