Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Akshaan Mazumdar3,787 Points
This Video is Confusing!!!!! Why are we using super if we are defining __init__ in the subclass as well?
Why is super required in this particular case? What does it actually simplify ?
even after going through this SuperDuper video several times and doing the project work, i never got the solid foundation on the "why" I would need the super(). If you are still as confused as i was try this video by Corey Schafer, https://www.youtube.com/watch?v=RSl87lqOXDE, that covers the same topic with a different set of examples that really helped. Seeing it a different way really helped solidify for me the function of super() and how it allows "inheritance" from parent class to child and yet allowing child to build more complexity as needed.
Dave StSomeWhere19,870 Points
I think of it as you are overriding the parent class
__init__ in the subclass. Then that parent
__init__ isn't executed.
Since you don't want to recode stuff already in the parent
__init__, you use super to get the parent stuff and your subclass specific stuff in your
__init__ (so kinda sorta like doing an include).