Locked learning resources

Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Locked learning resources

This lesson is for members only. Join us and get access to thousands of tutorials and a community of expert Pythonistas.

Unlock This Lesson

Intro to Object-Oriented Programming (OOP) in Python (Summary)

You learned about object-oriented programming (OOP) in Python. Most modern programming languages, such as Java, C#, and C++, follow OOP principles, so the knowledge that you gained here will be applicable no matter where your programming career takes you.

In this video course, you learned how to:

  • Define a class, which is a sort of blueprint for an object
  • Instantiate a class to create an object
  • Use attributes and methods to define the properties and behaviors of an object
  • Use inheritance to create child classes from a parent class
  • Reference a method on a parent class using super()
  • Check if an object inherits from another class using isinstance()

00:00 And that is a somewhat brief introduction to inheritance. We didn’t cover everything, but this gives you the general gist of how inheritance works. As you can see, inheritance can be extremely beneficial, but if it’s not used correctly, it can be more of a headache than anything else.

00:16 There’s nothing inherently wrong with duplicating code across classes, and in fact, Python won’t even stop you from doing that. But it’s often a good idea to evaluate your classes for “is a” relationships and then implement inheritance where it makes sense.

00:33 Remember, Python emphasizes readability and maintainability over having as few lines of code as possible. If it makes more sense for you not to use inheritance, don’t do it.

00:44 You can always implement it later on, but at that point it might be more difficult. Inheritance is one of the fundamental pillars of object-oriented programming, but it’s not the only one, and there’s even more to inheritance that we didn’t cover here.

00:58 But this tutorial is focused more on the fundamental principles of OOP rather than any specific features like inheritance, polymorphism, or encapsulation.

01:09 OOP is a huge topic and it’s hard to master, but hopefully now you have at least a basic appreciation for how large software is designed with classes and objects.

01:20 In my opinion, programming becomes a lot more fun with an understanding of OOP because you can move beyond writing trivial programs like a number guessing game and move onto writing real software using frameworks and libraries like Django and Matplotlib, both of which we have tutorials for on our website.

01:39 I’m Austin Cepalia with realpython.com, and I wish you the best of luck in your future programming endeavors. Happy coding.

Become a Member to join the conversation.