[Python-3000] Pre-peps on raise and except changes

Collin Winter collinw at gmail.com
Sat Jan 27 02:59:36 CET 2007


On 1/26/07, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Collin Winter wrote:
> > Does this language work for you?
> >
> > 2. ``raise E`` (with a single argument) is used to raise a new
> >    exception. This form has two sub-variants: ``E`` may be either an
> >    instance of ``BaseException`` [#pep352]_ or a subclass of
> >    ``BaseException``.
>
> That wording doesn't seem to cover the case where
> E is an instance of a subclass of BaseException.

>>> class A: pass
>>> class B(A): pass
>>> isinstance(B(), A)
True

Collin Winter


More information about the Python-3000 mailing list