Why destructors in …
 
Notifications
Clear all

Why destructors in python is not much needed as in C++?

1 Posts
2 Users
0 Likes
155 Views
0
Topic starter

Why destructors in python is not much needed as in C++?

1 Answer
0

In Python, destructors are not needed as much as in C++ because Python has a garbage collector that handles memory management automatically. The __del__() method is a known as a destructor method in Python. It is called when all references to the object have been deleted i.e when an object is garbage collected.

Share: