[Python-Dev] GeneratorExit inheriting from Exception

Guido van Rossum guido at python.org
Mon Mar 20 04:18:59 CET 2006


On 3/19/06, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
> Have we really being telling them to derive *directly*
> from Exception, or just that deriving somehow from
> Exception will become mandatory?

It doesn't matter. Most code that tries to be a good citizen today
derives its exceptions from Exception.

> For the purpose of minimising bare-except problems,
> recommending direct derivation from Exception seems
> like a particularly bad idea, whether the exception
> hierarchy is changed or not.

Why? With PEP 352 (== HEAD status quo) this works just fine.

I have a problem with using Error as the focal point since so many
exceptions (user-defined or otherwise) aren't errors. Not to mention
the Warnings which sometimes can be raised as Errors (but without
changing their type).

--
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-Dev mailing list