[Python-ideas] Inline 'raises' expression

BJörn Lindqvist bjourne at gmail.com
Wed Aug 27 15:52:49 CEST 2008


2008/8/24 Fredrik Johansson <fredrik.johansson at gmail.com>:
> Hi,
>
> It happens that I'm just interested in whether an expression raises an
> exception, not the return value. This might look something like
>
>    try:
>        check_status()
>    except IOError:
>        cleanup()

Seems like a bad example to me. Wouldn't you rather write:

try:
    check_status()
finally:
    cleanup()

??


-- 
mvh Björn



More information about the Python-ideas mailing list