From: Tino Dai <obe...@gmail.com>
To: nz*tutor pythonzzz <tutor@python.org>
>Sent: Monday, July 30, 2012 6:56 PM
>Subject: [Tutor] finally without try or except
>
>
>Hi!
>
>
> Is there anyway to execute a block of code at the end of a program in 2.6
>regardless of what happened before eg exiting normally or died because of an
>exception?
>I was thinking about maybe a free standing finally code block or a decorator.
>
>
>Any hints?
>Tino
>
>===> Hi, perhaps it's overkill, but you could define your own __exit__ (and
>__enter__) method so you can use a 'with' statement (context manager):
>http://docs.python.org/release/2.5.2/lib/typecontextmanager.html
>
_______________________________________________
Tutor maillist - Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor