[Python-Dev] Deprecating string exceptions

Jeremy Hylton jeremy@zope.com
Sat, 6 Apr 2002 00:38:07 -0500


>>>>> "BAW" == Barry A Warsaw <barry@zope.com> writes:

>>>>> "GvR" == Guido van Rossum <guido@python.org> writes:

  GvR> Well, it could certainly grow more standard stuff (like a
  GvR> traceback pointer) and that would be more useful if there was a
  GvR> common base class to inherit it from.

  BAW> Agreed.  Of course you can always play the old NeXTSTEP game of
  BAW> having one base class for backwards compatibility and another
  BAW> for the New Way, but that's probably more complexity than you
  BAW> really want.

I'm not sure what the base class(es) actually buys us.  We could just
as well say by fiat that the interpreter will set the traceback
attribute of an exception instance to the traceback.  Why do we need a
special base class to accomplish that?  This is Python.  You don't
need to do isinstance().  You just need to see if it has the right
attributes.

BTW, what is the signature for Exception.__init__()?  I've written
many exception classes, often subclasses of some other exception, but
I've hardly ever paid attention to the superclass __init__().  It
usually suffices to set the right attributes.

Jeremy