On 30/03/17 21:08, Alan Gauld via Tutor wrote:

> Of course, the __init__ methods are special in any way

Should have said *not special* in any way...

> But remember that not calling super potentially leaves
> some attributes of your superclass uninitialized. By not
> calling super you assume full responsibility for
> initializing both your sub class and the superclass.

And it's worth reminding ourselves that there could be several
superclasses not just the one we immediately inherit from.

Finally, this discussion has been in the context of
constructors but super() applies to all methods. There is
nothing unique about construction, it's just like any
other method call where you want to include the
superclass functionality.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to