[Python-Dev] Exception Reorg PEP checked in

Nick Coghlan ncoghlan at gmail.com
Thu Aug 4 12:07:40 CEST 2005


Brett Cannon wrote:
> OK, once the cron job comes around and is run,
> http://www.python.org/peps/pep-0348.html will not be a 404 but be the
> latest version of the PEP.
> 
> Differences since my last public version is that it has
> BaseException/Exception as the naming hierarchy, Warning inherits from
> Exception, UserException is UserError, and StandardError inherits from
> Exception.  I also added better annotations on the tree for noticing
> where inheritance changed and whether it become broader (and thus had
> a new exception in its MRO) or more restrictive (and thus lost an
> exception).  Basically everything that Guido has brought up today
> (08-03).
> 

If/when you add a "Getting there from here" section, it would be worth noting 
that there are a few basic strategies to be applied:

  - for new exceptions:
     - just add them in release 2.x

  - for name changes:
     - add the new name as an alias in release 2.x
     - deprecate the old name in release 2.x
     - delete the old name in release 2.(x+1)

  - to switch inheritance to a new exception type:
     - add the inheritance to the new parent in release 2.x
     - delete the inheritance from the old parent in release 3.0

  - to switch inheritance to an existing exception type:
     - add the inheritance to the new parent in release 3.0
     - delete the inheritance from the old parent in release 3.0

Cheers,
Nick.

-- 
Nick Coghlan   |   ncoghlan at gmail.com   |   Brisbane, Australia
---------------------------------------------------------------
             http://boredomandlaziness.blogspot.com


More information about the Python-Dev mailing list