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

Why didn't he use super() for the class thieves??

Why didn't he use super() for the class thieves and did for the attributes if they don't inheritance any class?

1 Answer

Chris Freeman
MOD
Chris Freeman
Treehouse Moderator 68,423 Points

Great Question! In the design of Thief, Agile, Sneaky, and Character, Kenneth letting the inherented class do all the initialization. By not including a __init__ method In Thief, Python will use the first __init__ found in the Method Resolution Order (MRO), that is, by scanning down in inheritance list.

Upon finding the first __init__, execution would stop there if there wasn’t a super() call to say, “also run the next __init__ found by continuing to scanning down the chain, then come back here. This means Agile.__init__ is started first, then a jump to Sneaky.__init__, then a jump to Character.__init__, then back to Sneaky, the finally the init completes back in Agile.

Post back if you need more help. Good luck!!!

thanks