Supercharge Your Classes With Python super() (Summary)
In this video course, you learned how to supercharge your classes with super()
. Your journey started with a review of single inheritance and then showed how to call superclass methods easily with super()
.
You then learned how multiple inheritance works in Python, and techniques to combine super()
with multiple inheritance. You also learned about how Python resolves method calls using the method resolution order (MRO), as well as how to inspect and modify the MRO to ensure appropriate methods are called at appropriate times.
For more information about object-oriented programming in Python and using super()
, check out these resources:
- Official
super()
documentation - Python’s
super()
Considered Super by Raymond Hettinger - Object-Oriented Programming in Python
Congratulations, you made it to the end of the course! What’s your #1 takeaway or favorite thing you learned? How are you going to put your newfound skills to use? Leave a comment in the discussion section and let us know.
00:00
And there you have it. This course has talked about how objects and classes work together in Python, how you can compose them using object inheritance, how super()
allows you to get at different methods inside of the single inheritance and multiple inheritance mechanisms.
00:14
How the method resolution order tells Python what super()
should be calling, the complexities of multiple inheritance, where you have name clashes and the potential challenges of different parameters for constructors in your inheritance hierarchy.
00:27 Finally, I also talked about mix-ins, a real-world example where inheritance often gets used.
00:33 I hope this course was useful to you. Thank you for your attention.
Become a Member to join the conversation.