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

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,887 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