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
mourad marzouk
5,560 Pointswhy is there a super there
In this video he has a super in the very first parent class...
class Hand(list): def init(self, size=0, *args, **kwargs): super().init() #this one, why is this here?
Why is that there?
2 Answers
Nicholas Tan
Courses Plus Student 8,562 PointsThis is because Hand class is a subclass from List.
Hence it is correct to have the super().init() to initialize the list parent class.
mourad marzouk
5,560 PointsAh ok I see. so its using the built in list() method as a parent class. so follow up why is he doing that?
Nicholas Tan
Courses Plus Student 8,562 Pointslets simply put it this sub class is trying to act like a list hence he actually inherits the list class.
I hope this clarify your doubt?