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![](https://ecs-static.teamtreehouse.com/assets/views/marketing/shared/community-banner-white-47072046c51352fe6a69f5e691ff5700b28bb11d45197d7bdf066d9ea3f72d0c.webp)
![Gaurav Munjal](https://secure.gravatar.com/avatar/4d61d53989af3d89c258038fade0d997?s=96&d=https%3A%2F%2Fecs-static.teamtreehouse.com%2Fassets%2Fcontent%2Fdefault_avatar-445fbbabfc8dc9188fb5967fe43322ee0c3e0dd1e10f378bf8343784af5a13eb.webp&r=pg)
Gaurav Munjal
398 PointsMultiple Inheritance Conceptual Question
In the video, at around 5 min, it says that "sneaky" and "agile" arguments may not be recognized by certain python versions because certain properties do not travel all the way up to top parent class.
- Question 1 - Why ?
- Question 2 - Why do have
super().__init__
in sneaky and agile classes if the only parent class they have is Object ? - Question 3 - What benefit do we get in making character class as final class ?
1 Answer
![Chris Freeman](https://uploads.teamtreehouse.com/production/profile-photos/1153532/micro_image.jpg)
Chris Freeman
Treehouse Moderator 68,425 PointsGood questions:
Question 1 - Why ?
I could not find the specific case where the version of Python would matter in the MRO unless you go back to an very old version of Python 2, So, I would say the comment is moot if you're using a modern 2.7+, 3.5+ version of Python.
Please note that with Character
as the first class in the inheritance list and the Character.__init__
does not have a super
call, neither Agile.__init__
or Sneaky.__init__
would be executed. The setting of the self.sneaky
attribute is happening in the Character
loop using setattr
.
Question 2 - Why do have super().__init__
in sneaky and agile classes if the only parent class they have is Object ?
Any super
call become effectives when there are multiple parent classes are inherited from. A super
within` a parent class says "if I don't have a parent, then run this same method contained *in the next parent in the inherited list". The Agile.super
calls Sneaky
. The Sneaky.super
calls Character
.
Question 3 - What benefit do we get in making character class as final class ?
By making Character
the final class, it allows that class to be the default structure of the defined class Thief
. Any supplemental features added to augment the Thief
class can then be added before Character
. In terms of design, Character
is the "base class" of Thief
and the classes Agile
and Sneaky
can be thought of as "add in features".
Post back if you wish more clarification. Good luck!!