Re:Google's Python style guide
by plq on Thursday April 19, 2012 @03:54AM
(#3861873)
> Never use catch-all except: statements, or catch Exception or StandardError, unless you are re-raising the exception or in the outermost block in your thread (and printing an error message). Python is very tolerant in this regard and except: will really catch everything including Python syntax errors. It is easy to hide real bugs using except:.
What kind of SyntaxErrors are cought by the except: handler? Not all, I presume:
try:
a b
except:
pass
This fails with SyntaxError on Python 2.7.2 on my machine.
What kind of SyntaxErrors are cought by the except: handler? Not all, I presume:
This fails with SyntaxError on Python 2.7.2 on my machine.