The exception hierarchy in Python 3 is shallower than in Python 2.

Here is a partial list of exceptions in Python 2:


BaseException
 +-- SystemExit
 +-- KeyboardInterrupt
 +-- GeneratorExit
 +-- Exception
      +-- StandardError
      |    +-- AttributeError
      |    +-- ImportError
      |    +-- NameError
      |    +-- TypeError
      |    +-- ValueError 
      +-- Warning

and the same again in Python 3:

BaseException
 +-- SystemExit
 +-- KeyboardInterrupt
 +-- GeneratorExit
 +-- Exception
      +-- AttributeError
      +-- ImportError
      +-- NameError
      +-- SystemError
      +-- TypeError
      +-- ValueError
      +-- Warning


Note that StandardError is gone. 

Does anyone use StandardError in their own code? In Python 2, I normally 
inherit from StandardError rather than Exception. Should I stop and just 
inherit from Exception in both 2 and 3?


-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to