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!

Kaio Nigro
Kaio Nigro
4,168 Points

Confused with the purpose of super()

I am a little confused as far as the purpose of the super() in the code.

When we create a class Thief(Character) isn't is supposed to inherit the method of the Character class? So wouldn't it already be getting the name from the parent class?

Isn't the point of inheritance that we don't repeat ourselves, the way I'm seeing it now just feels like I'm rewriting the code in the Thief class.

Can anyone help me understand that better? The video is not very clear to me.

Thank you Kaio

1 Answer

Alex Koumparos
seal-mask
.a{fill-rule:evenodd;}techdegree
Alex Koumparos
Python Development Techdegree Student 36,861 Points

Hi Kaio,

You're not alone in having this question. I've already written quite a long explanation here.

Take a look and see if it clears things up for you. If not, I'm happy to provide further clarification.

Cheers

Alex