On 30/03/17 12:39, Rafael Knuth wrote:
>>>> I am trying to wrap my head around the super constructor.
> 
> Is it possible to embed a super constructor into an if / elif
> statement within the child class?

Of course, the __init__ methods are special in any way
the normal coding mechanisms all work. If for some
reason you only want to call super some of the time
then by all means put it inside an if clause.

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.


-- 
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