[Python-Dev] Proposing a sys.special_exceptions tuple

Phillip J. Eby pje at telecommunity.com
Thu Sep 30 16:19:22 CEST 2004


At 08:21 PM 9/30/04 +1000, Nick Coghlan wrote:
>However, another possibility occurred to me:
>
>try:
>   # Do stuff
>except sys.special_exceptions:
>   raise
>except:
>   # Deal with all the mundane stuff
>
>With an appropriately defined tuple, that makes it easy for people to "do the
>right thing" with regards to critical exceptions. Such a tuple could also be
>useful for invoking isinstance() and issubclass().

+1.  This would be a big help for developers, if only in that it will tell 
us what exceptions we ought to do this with.

IMO, this is probably important enough to make it a builtin; maybe call it 
CriticalExceptions or some such.

Also, maybe in 2.5 we could begin warning about bare excepts that aren't 
preceded by non-bare exceptions.



More information about the Python-Dev mailing list