Welcome to the Treehouse Community
The Treehouse Community is a meeting place for developers, designers, and programmers of all backgrounds and skill levels to get support. Collaborate here on code errors or bugs that you need feedback on, or asking for an extra set of eyes on your latest project. Join thousands of Treehouse students and alumni in the community today. (Note: Only Treehouse students can comment or ask questions, but non-students are welcome to browse our conversations.)
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and a supportive community. Start your free trial today.
Akshaan Mazumdar3,127 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,822 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).