A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from http://mail.python.org/pipermail/python-list/2005-September/339148.html below:

class 'Exception', unable to use 'super' to call superclass initializer

class 'Exception', unable to use 'super' to call superclass initializerPeter Hansen peter at engcorp.com
Sat Sep 10 17:37:18 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?

Exceptions do not inherit from 'object'; they are old-style classes.

super() can be used only with new-style classes (which subclass 'object').

-Peter

More information about the Python-list mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4