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.

Python Object-Oriented Python Inheritance Super-Duper!

Johnny Austen
.a{fill-rule:evenodd;}techdegree seal-36
Johnny Austen
Front End Web Development Techdegree Graduate 35,455 Points

Trying 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
Steven Parker
210,425 Points

You 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.