Python OOP
The letters OOP are short for Object-Oriented Programming.
Python supports this style, so you can organize your code around classes and objects, which keeps it tidy and makes it easier to reuse.
Advantages of OOP
Here is what OOP gives you:
- Programs with a clear, well-defined structure
- Code that is simpler to maintain, debug and use again
- Less duplication, in line with DRY (Don't Repeat Yourself)
- Reusable applications built from fewer lines of code
Tip: DRY simply asks you not to write the same code twice. When you notice repetition, pull it out into a function or class and call that instead.
What are Classes and Objects?
Object-oriented programming rests on two ideas: classes and objects.
Think of the class as the description of what an object should be like, and the object as something built from that description.
Every object you build receives all the variables and functions that the class defines.