revisiting the "What am I running on?" question
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. Don't use a bare except clause even if your
code is 100% perfect every time. (And anyone who thinks their code is
perfect hasn't tested it.)