[Python-Dev] Deprecating string exceptions

Martin v. Loewis martin@v.loewis.de
27 Mar 2002 23:17:02 +0100


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

> > Paul Prescod <paul@prescod.net> writes:
> > 
> > > Should it be arbitrary objects or just subclasses of exception: "It is
> > > recommended that user-defined exceptions in new code be derived from
> > > Exception, although for backward compatibility reasons, this is not
> > > required. Eventually this rule will be tightened."
> 
> [Martin]
> > If that is the rule, the bug report can be closed as "not-a-bug".
> 
> I seem to have a particularly dense day. :-(
> 
> What does "that" (in "If that is the rule") refer back to?

"user-defined exceptions be derived from Exception". It is only a
recommendation in the sense that you can use arbitrary classic
classes. If the rule is eventually tightened, it is ok if new-style
classes are not allowed as exceptions right now. An action is only
needed if you pronounce that it is desirable to allow new-style
classes as exceptions - which would necessarily have a base class that
is not derived from Exception.

Regards,
Martin