using super

sashan mabus at operamail.com
Sat Oct 18 18:10:39 EDT 2003


I'm trying to use super but keep getting the following error

E:\Code\Python\Nexus\Player>python ./super_test.py
Traceback (most recent call last):
  File "./super_test.py", line 14, in ?
    main()
  File "./super_test.py", line 11, in main
    b = B()
  File "./super_test.py", line 7, in __init__
    super(B, self).__init()
TypeError: super() argument 1 must be type, not classobj

Here's the code:
class A:
    def __init__(self):
        print 'A'
       
class B(A):
    def __init__(self):
        super(B, self).__init()
        print 'B'
       
def main():
    b = B()
   
if __name__ == '__main__':
    main()
   





More information about the Python-list mailing list