|
On 9/23/06, John Belmonte <john@neggie.net> wrote:
The D language has native support for this [3], allowing you to execute actions on scope failure (i.e. when an exception occurred), success, or both. Functional/object implementations work just as well, such as the ScopeGuard class for C++ [4].
python 1.5 added a "with" statement for cleanup on block exit: with open('/etc/passwd', 'r') as f: for line in f: <do stuff> # f is closed here http://docs.python.org/whatsnew/pep-343.html