class 'Exception', unable to use 'super' to call superclass initializer
Robert Kern
rkern at ucsd.edu
Sat Sep 10 17:33:12 EDT 2005
chriss wrote:
> Hi,
>
> environment: Python 2.4, GNU/Linux, kernel 2.6.12.2
>
> having subclassed 'Exception' I'm trying to call the initialiser
> __init__(...) of the superclass Exception with 'super(..).__init__(..)' .
> However, trying to do so results in a
> 'TypeError: super() argument 1 must be type, not classobj'.
>
> Now, if I use 'Exception.__init__(..)' instad of super(..)... ,everything
> works just as one would expect.
>
> Why does 'super(..).__init__(..)' fail?
AFAICT, the Exception hierarchy are still old-style classes while
super() only works on new-style classes.
--
Robert Kern
rkern at ucsd.edu
"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
More information about the Python-list
mailing list