I am new to Python, I want to understand more the purpose of the __delete__ method.
In my case I got a class that opens a file and I want to add file.close in __delete__ method. Would you consider this as a good idea? Or does the __delete__ is used in a different way?
From the docs I am not sure that am using it right. http://python-reference.readthedocs.io/en/latest/docs/dunderdsc/delete.html
__delete__is one of the descriptor methods. Perhaps you want__del__?__delete__is part of the descriptor protocol. Are you writing a descriptor?__del__, if that is indeed what you mean. You probably want a context manager.__exit__, not either__del__or__delete__.