3 ms·
Context managers change the API a lot though. If the resource cleanup is an implementation detail like freeing a handle to some C data, it's much better to do t
by syllogism 8y ago
Context managers change the API a lot though. If the resource cleanup is an implementation detail like freeing a handle to some C data, it's much better to do that in a __del__ method.
- wwright 8y agoIf context managers have changed your API, then the context of the resources is no longer an implementation detail; the lifetime of your object and the lifetime of your resources are linked.