Advertisements
Advertisements
Question
Is an object of a class mutable? Why/why not?
Short Answer
Advertisements
Solution
Yes. A class object (instance) is generally mutable because its attributes can be added, modified or deleted after the object is created.
student.name = "Aman" # Add/modify an attribute
del student.name # Delete an attribute
The object's namespace changes; therefore, the object is mutable.
shaalaa.com
Is there an error in this question or solution?
