I do things mostly in C++, where the destructor method is really meant for destruction of an acquired resource. Recently I started with python (which is really a fun and fantastic), and I came to learn it has GC like java. Thus, there is no heavy emphasis on object ownership (construction and destruction).
As far as I've learned, the __init__()
method makes more sense to me in python than it does for ruby too, but the __del__()
method, do we really need to implement this built-in function in our class? Will my class lack something if I miss __del__()
? The one scenario I could see __del__()
useful is, if I want to log something when destroying an object. Is there anything other than this?