R: [Python-Dev] Deprecating string exceptions
Samuele Pedroni
pedroni@inf.ethz.ch
Wed, 27 Mar 2002 23:38:24 +0100
From: Martin v. Loewis <martin@v.loewis.de>
> Guido van Rossum <guido@python.org> writes:
>
> >
> > 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.
>
But this is legal in 2.2
>>> class Z(str,Exception):
... pass
...
>>> Z.__bases__
(<type 'str'>, <class exceptions.Exception at 0x00757700>)
>>> Z.__base__
<type 'str'>
so the issue is more subtle or I'm missing something?
regards.