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 we import subclass(Thief) not superclass(Character).if I have more than one subclass which one will I should import?

from characters import Thief

1 Answer

Jeff Muday
MOD
Jeff Muday
Treehouse Moderator 28,720 Points

I like how you are thinking about this. I too would prefer starting with a generic Character class and having the Thief class be a child of Character.

But the point that Kenneth is trying to make is about how to handle MRO (multiple resolution order). It is kind of a subtle detail that is an "Intermediate" Python topic.

Before you are done with the Python coursework Treehouse, you will encounter MRO under the topic of "Mixins" in both Flask and Django.

Here is an excellent blog post that covers MRO with a simple example.

https://blog.pilosus.org/posts/2019/05/02/python-mixin/