[Python-Dev] Exceptions *must*? be old-style classes?

Jim Jewett jimjjewett at gmail.com
Sat Jan 15 01:20:31 CET 2005


Phillip J. Eby wrote (in
http://mail.python.org/pipermail/python-dev/2005-January/050854.html)

> * Classic class support is a must; exceptions are still required to be 
> classic, and even if they weren't in 2.5, backward compatibility should be 
> provided for at least one release.

The base of the Exception hierarchy happens to be a classic class.
But why are they "required" to be classic?

More to the point, is this a bug, a missing feature, or just a bug in 
the documentation for not mentioning the restriction?

You can inherit from both Exception and object.  (Though it turns out
you can't raise the result.)  My first try with google failed to produce an
explanation -- and I'm still not sure I understand, beyond "it doesn't
happen to work at the moment."  Neither the documentation nor the 
tutorial mention this restriction.

http://docs.python.org/lib/module-exceptions.html
http://docs.python.org/tut/node10.html#SECTION0010500000000000000000

I didn't find any references to this restriction in exception.c.  I did find
some code implying this in errors.c and ceval.c, but that wouldn't have 
caught my eye if I weren't specifically looking for it *after* having just
read the discussion about (rejected) PEP 317.  

-jJ


More information about the Python-Dev mailing list