In the last few versions pyflakes has warned about bare excepts:
try: ... except: ...
which have the unpleasant side effect of catching
SystemExit. I have previously taken the view that it’s basically OK if the
except block contains a bare
try: ... except: ... raise
… but in practice beginners make mistakes with this all the time. You can always very conveniently write
the latter offering very little possibility that beginners will use it by mistake. So I came round to the idea that “explicit is better than implicit”.
Could the bare except syntax be officially deprecated, eg. behind a
>>> from __future__ import bare_except >>> try: ... ... ... except: Traceback (most recent call last): File "<stdin>", line 1, in <module> SyntaxError: except statement must have an exception type expression >>> bare_except _Feature((3, 9, 0, 'alpha', 1), (3, 11, 0, 'alpha', 0), ...)