> Matthew Sherborne wrote: > > What's up with the new super method? It tells me it takes a type and > not a class... > > Am I using it wrong? > > >>> class A: > ... def speak(self): > ... print 'hi' > ... > >>> class B(A): > ... def speak(self): > ... super(B, self).speak() > ... print 'there' > ... > >>> obj = B() > >>> obj.speak() > Traceback (most recent call last): > File "<stdin>", line 1, in ? > File "<stdin>", line 3, in speak > TypeError: super() argument 1 must be type, not class > >>>
The super() call is only supported for new-style classes, e.g. those that inherit from 'object'. >>> class A(object): ... def speak(self): ... print 'hi' ... >>> class B(A): ... def speak(self): ... super(B, self).speak() ... print 'there' ... >>> obj = B() >>> obj.speak() hi there Note the difference in the first line. -- David Ascher _______________________________________________ ActivePython mailing list [EMAIL PROTECTED] To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs