Python Programming - Classes - Discussion

Discussion Forum : Classes - General Questions (Q.No. 10)
10.
What is the purpose of the __del__ method?
It is called when an object is created.
It is used to delete a class variable.
It is called when an object is about to be destroyed and its memory released.
It defines the destructor of the class.
Answer: Option
Explanation:
The __del__ method is a special method in Python classes that is called when an object is about to be destroyed and its memory is released. It is often used to perform cleanup operations before an object is removed from memory.
Discussion:
Be the first person to comment on this question !

Post your comments here:

Your comments will be displayed after verification.