by saagarjha · 8y ago · 0 comments
When the interpreter exits, your program's resources should be reclaimed by the operating system, right? So why not just use __del__?
And in cases like the one cjhanks describes, __del__ doesn't get called reliably enough. In those cases, using a contextmanager is better.
As others have said, there's rarely reason to override `__del__`, and when you do you know exactly why you need it.