[Tutor] finally without try or except
Alan Gauld
alan.gauld at btinternet.com
Mon Jul 30 21:24:46 CEST 2012
On 30/07/12 17:56, Tino Dai wrote:
> 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?
Yes, try/finally.
That's what it's there for.
> I was thinking about maybe a free standing finally code block or a
> decorator.
is
try:
really too much work?
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
More information about the Tutor
mailing list