[Tutor] if value not in dictionary, do a?

Blockheads Oi Oi breamoreboy at yahoo.co.uk
Fri Mar 25 17:56:25 CET 2011

On 25/03/2011 16:11, Robert Sjoblom wrote:

> I received your email just as I left my computer, and didn't want to
> type out an answer on my phone (because smartphones aren't smart
> enough for that yet), and my first reaction was "why?" followed by "I
> need my program to continue even if I get the errors at this part, so
> why?" I soon realized that catching all errors would mean never seeing
> the errors you might not foresee. I know that I could get either
> ValueError or KeyError, but there could be something else somewhere
> else in the code that could send an error (unlikely as it is) down
> that path and with a blank except I would never actually see that
> happen. Am I somewhat close to the real reason why?

If you accidentally create an infinite loop you can't break out of it 
with Ctrl-C or whatever if you're catching all exceptions :)

More information about the Tutor mailing list