[Python-Dev] Draft Guide for code migration and modernation
Guido van Rossum
Mon, 03 Jun 2002 15:42:49 -0400
> Pattern: NewError = 'NewError' --> class NewError(Exception): pass
> Idea: String exceptions are deprecated, derive from Exception base class.
> Version: Any
> Benefits: String exceptions will not work in future versions. Allows except Exception: clause to work.
> Locating: Use PyChecker
Should also warn against class exceptions not deriving from Exception.
Be careful about generic phrases like "String exceptions will not work
in future versions." Some people (especially those who tend to fear
change ;-) start to panic when they read this, thinking it might be in
2.4. I don't think we'll be able to delete string exceptions before
Python 3.0, so you can be explicit in this case.
--Guido van Rossum (home page: http://www.python.org/~guido/)