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

Collin Winter collinw at gmail.com
Wed Jan 24 00:03:18 CET 2007


On 1/23/07, Brett Cannon <brett at python.org> wrote:
> On 1/23/07, Collin Winter <collinw at gmail.com> wrote:
> >This form has two sub-variants: ``E`` may be either an
> > instance of ``BaseException`` [#pep352]_ or a subclass of
> > ``BaseException``. If ``E`` is a subclass, it will be called with
> > no arguments to obtain an exception instance.
> >
> > To raise anything else is an error.
> > """
>> I don't think that calling them a variant is right. You can only
> raise subclasses of BaseException (which implicitly implies
> BaseException itself). If you want to mention BaseException itself
> that's fine, but there is no variant here; there is a single rule.

You can raise both subclasses of BaseException and instances of
subclasses of BaseException. Are you intended to make the latter
illegal?
Collin Winter


More information about the Python-3000 mailing list

AltStyle によって変換されたページ (->オリジナル) /