[Python-ideas] except expression

Jan Kaliszewski zuo at chopin.edu.pl
Wed Feb 19 02:56:58 CET 2014


18.02.2014 22:42, Greg Ewing wrote:

> Paul Moore wrote:
>> I could argue that
>> "bare except" is more acceptable in an *expression* context because
>> expressions should never be so complex that the reasons why it's bad
>> in a statement context actually apply.
>
> The expression itself doesn't have to be complicated.
> Even a simple expression such as x[i] can invoke arbitrary
> code, and therefore raise arbitrary exceptions, including
> ones that represent bugs and therefore shouldn't be
> silenced.

And including KeyboardInterrupt which, with the default SIGINT handler,
can be raised *at any point*, beetween any bytecode instructions (what
is a serious trouble for critical with|finally-based cleanups but it's
another story).

Cheers.
*j



More information about the Python-ideas mailing list