osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

revisiting the "What am I running on?" question


On 2/19/2019 10:06 AM, Chris Angelico wrote:
> On Wed, Feb 20, 2019 at 2:04 AM Chris Angelico <rosuav at gmail.com> wrote:
>>
>> On Wed, Feb 20, 2019 at 1:59 AM songbird <songbird at anthive.com> wrote:
>>>
>>> MRAB wrote:
>>> ...
>>>> Don't use a bare except, it'll catch _any_ exception.
>>>
>>>    that's ok with this code IMO, but i see your point.
>>>
>>
>> Not really, no. It means that ANY bug (barring an outright syntax
>> error) inside the try block will silently move you on to the next
>> check, possibly after printing out the message.
> 
> Oh, and not just bugs either. If the user hits Ctrl-C at just the
> right moment, KeyboardInterrupt will be raised. You'll swallow that
> exception silently, preventing the user-requested halt, and going and
> doing the wrong thing.

KeyboardInterrupt, SystemExit, and GeneratorExit are BaseExceptions but 
not Exceptions

-- 
Terry Jan Reedy