[Python-Dev] Exceptions *must*? be old-style classes?
Guido van Rossum
gvanrossum at gmail.com
Mon Jan 17 19:16:45 CET 2005
On Mon, 17 Jan 2005 11:35:53 -0500, Phillip J. Eby
<pje at telecommunity.com> wrote:
> At 04:06 PM 1/17/05 +0000, Michael Hudson wrote:
> >a) Is Exception to be new-style?
>
> Probably not in 2.5; Martin and others have suggested that this could
> introduce instability for users' existing exception classes.
Really? I thought that was eventually decided to be a very small amount of code.
> >b) Somewhat but not entirely independently, would demanding that all
> > new-style exceptions inherit from Exception be reasonable?
>
> Yes. Right now you can't have a new-style exception at all, so it would be
> quite reasonable to require new ones to inherit from Exception.
That would be much more reasonable if Exception itself was a new-style
class. As long as it isn't, you'd have to declare new-style classes
like this:
class MyError(Exception, object):
...
which is ugly.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-Dev
mailing list