There are several differences, apart from Pokémon exception handling* being a bad idea.
Neither except Exception:
nor except BaseException:
will catch old-style class exceptions (Python 2 only):
>>> class Foo(): pass
...
>>> try:
... raise Foo()
... except Exception:
... print 'Caught'
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
__main__.Foo: <__main__.Foo instance at 0x10ef566c8>
>>> try:
... raise Foo()
... except BaseException:
... print 'Caught'
...
Traceback (most recent call last):
File "<stdin>", line 2, in <module>
__main__.Foo: <__main__.Foo instance at 0x10ef56680>
>>> try:
... raise Foo()
... except:
... print 'Caught'
...
Caught
because the old-style object is not derived from BaseException
or Exception
. This is a good reason to never use custom exceptions that do not derive from Exception
, in any case.
Next, there are three exceptions that derive from BaseException
, but not from Exception
; in most cases you don't want to catch those. SystemExit
, KeyboardInterrupt
and GeneratorExit
are not exceptions you would want to catch in the normal course of exception handling. If you use except BaseException:
you do catch these, except Exception
will not.
* Pokémon exception handling because you gotta catch em all.