2 ms·
> You use exceptions to clean up resources even when there are no errors? exception handling mechanisms (try/except/finally) are idiomatic for that in language
by dragonwriter 5y ago
> You use exceptions to clean up resources even when there are no errors?
exception handling mechanisms (try/except/finally) are idiomatic for that in languages with them (try/finally, particularly, because it assures cleanup whether or not an unhandled exception occurred); defer offers equivalent power with slightly different structure; you don't need both for any purpose either will do.