[Tutor] super constructor usage

Alan Gauld alan.gauld at yahoo.co.uk
Thu Mar 30 16:08:13 EDT 2017

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
Follow my photo-blog on Flickr at:

More information about the Tutor mailing list