Programming & syntax · reviewed in July 2026
Object-oriented programming
Object-oriented programming (OOP) is a programming style that organizes code into classes — templates combining data (attributes) and behavior (methods) — and objects, which are concrete instances of those classes. Python supports it natively alongside other styles, like functional programming.
Frequently asked questions
What's the difference between a class and an instance?
A class is the template (for example class Dog) defining what attributes and methods its objects will have; an instance is a concrete object created from that class (my_dog = Dog()).
What is inheritance?
It's the mechanism by which a class can reuse and extend another class's (the base class's) behavior, without having to rewrite its code.
Do you have to use OOP in Python?
No. Python lets you write complete programs with plain functions and basic data structures; OOP is just another tool, useful when modeling the problem as objects with their own state simplifies the design.