Multiple Superclasses8:31 with Kenneth Love
We're not limited to a single parent class in Python. Let's see how to use this feature to make our code even more clean and clear.
You can use
class.__mro__ to look at your class's method resolution order (MRO) if you're curious. Or use the
inspect.getmro() function with your class to get the same information. This can be really handy if you're not sure what order the classes are being assembled.
When you're using multiple inheritance,
super() calls become really important. They let things like
__init__ travel all the way up the chain to make sure the class has all of the bits and pieces that it needs.
You need to sign up for Treehouse in order to download course files.Sign up