calling super()

John Clark clajo04 at
Wed Apr 4 21:30:53 CEST 2007

Yeah!!! One I can actually answer!!!

super() only works on new-style classes - your classes don't have object
anywhere in the inheritance tree so super() isn't going to help..

New-style classes are known as types, old-style classes are known as

Hope this helps,

-----Original Message-----
From: at
[ at] On Behalf Of
Finger.Octopus at
Sent: Wednesday, April 04, 2007 3:23 PM
To: python-list at
Subject: calling super()

Hello, I have been trying to call the super constructor from my derived
class but its not working as expected. See the code:

class HTMLMain:
    def __init__(self):
        self.text = "<HTML><BODY>";
    def __del__(self):
        self.text = "</BODY></HTML>";

class NewPage(HTMLMain):
    def __init__(self):
        print 'derive2 init'
        super(NewPage, self).__init__();

N = NewPage();
del N

And here's the error message I get:

Traceback (most recent call last):
  File "e:/PyEN/", line 16, in <module>
    N = NewPage();
  File "e:/PyEN/", line 12, in __init__
    super(NewPage, self).__init__();
TypeError: super() argument 1 must be type, not classobj


More information about the Python-list mailing list