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 trialJohnny Austen
Front End Web Development Techdegree Graduate 35,494 PointsTrying to understand exactly what super() does?
Hi, got a couple quick questions about super() if anyone can help!
1) So is super() only used when you want to override the init function from the parent class?
2) Why do you need to redefine def init (arguments) and then redefine them again (in this video on the next line) using super().init(arguments)?
1 Answer
Steven Parker
231,236 PointsYou would use "super" when you override any method and want to access the version in the parent.
The line with "super" on it is not a definition, it is calling the method of the parent. The arguments are being passed to the function instead of being declared as parameters as they are on the "def" line.