Prev: pyqt Error with qtdesigner button groups
Next: Builtn super() function. How to use it with multipleinheritance? And why should I use it at all?
From: Gregory Ewing on 24 Jul 2010 21:58 Lacrima wrote: > But what if SuperClass1 is from third party library? If it hasn't been designed for super(), then you can't use super() with it. super() only works when *every* class in the hierarchy has been designed with it in mind. -- Greg
From: Gregory Ewing on 25 Jul 2010 20:30
Raymond Hettinger wrote: > Every class > in the MRO implementing the target method *must* call super() to give > the next class in the MRO a chance to run. EXCEPT for the last one, which must NOT call super! The posted example happens to work because object has a default __init__ method that does nothing. But this is not generally true of other methods, which means you need a "terminating" class at the end of the MRO whose methods don't call super. -- Greg |