try..except with empty exceptions

Cameron Simpson cs at
Sun Apr 12 08:41:23 CEST 2015

On 12Apr2015 16:33, Cameron Simpson <cs at> wrote:
>Finally, if we were to expunge support for "except:", one would also need a 
>cast iron guarrentee that no exception could possibly occur which was not a 
>subclass of BaseException. I'd expect that to mean that "raise" of a 
>non-instance of BaseException to itself raise a TypeError.

And I see that Steven D'Aprano has already pointed out PEP 352:

which is marked "Status: Final". It says:

  The raise statement will be changed to require that any object passed to it 
  must inherit from BaseException. This will make sure that all exceptions fall 
  within a single hierarchy that is anchored at BaseException [2] . This also 
  guarantees a basic interface that is inherited from BaseException. The change 
  to raise will be enforced starting in Python 3.0 (see the Transition Plan 

Hmm. Not in 2.7? I can see the breakage it could cause, but where does that 
leave me? I think I could probably move to catching Exception almost across the 
board even in 2.5+ and feel pretty good.

Cameron Simpson <cs at>

If your new theorem can be stated with great simplicity, then there
will exist a pathological exception.    - Adrian Mathesis

More information about the Python-list mailing list