In this chapter, we will discuss the concept of Object-Oriented Programming in Python. We also call it OOPS in Python as a short form. An object is anything present in this world, and a class can be said as an abstract idea which defines the object’s behaviour. For example, let’s consider a dog named Tommy, who exists in the real world. If Tommy is viewed as an object, then Dog is the class. Tommy will action all the characteristics that are defined under Dog class. The attributes of the dog class, such as Color, Age, Weight, and Height, will be the attributes for Tommy and any other dog on this planet. Let’s understand it in simpler terms in the image below.
As you can see, the dog class has attributes such as Color, Age, Weight, and Height. It also has methods for dogs’ activities such as Sleeping, Running, and Barking. So when we create the objects for the real dogs Tommy and Jimmy, these objects will also have attributes and methods of the class Dog. Easy, isn’t it? Object-oriented programming languages have become so popular in the past few decades.
The following chapters will guide you through the concepts of Object-Oriented Programming in Python. And for your convenience, we are listing them here below for you.
- Chapter 40: Python Classes
- Chapter 41: Python Variables Types
- Chapter 42: Python Methods Types
- Chapter 43: Pass members of one class to another class
- Chapter 44: Inheritance in Python
- Chapter 45: Types of Inheritances in Python
- Chapter 46: Polymorphism in Python
- Chapter 47: Abstract Class and Abstract Method
- Chapter 48: Interfaces in Python
- Chapter 49: Encapsulation in Python
Link to all chapters in our Python tutorial series: Learn Python
Please bookmark this webpage for your reference so you can look at all the concepts of Object-Oriented Programming in Python in one go whenever you’d like to revisit them.
Please find below the advantages of Object-Oriented Programming in Python.
- We can reuse the code through inheritance and have the program shorter.
- The code can be flexible through Polymorphism.
- We can easily upgrade smaller systems with the Object-Oriented programming concept to larger systems.
- We can hide the data by implementing encapsulation in our Python programs.