Object-oriented Programming (OOP) is a language model (or paradigm) in which properties or behaviors are organized into “objects”. Some languages encourage a more procedural style, like if you were writing a recipe - some popular examples are COBOL and BASIC. Languages that adopt an Object-oriented style organize things into objects, and provide methods for objects to communicate with one another.

What is an object?

An object can be a function, a variable, a property, a class… everything in Python is an object. You can think of an object as a generic container - a list object might contain a sequence of int objects, along with some function objects. The int objects contain integer numbers. The function objects contain code that can be executed on the list object or maybe on the items in the list.

Python and OOP

Python buys heavily into the OOP model - you’ll find that everything in Python is an object of some kind, and almost everything has attributes and methods.

This doesn’t mean you have to use OOP in your programs - Python works perfectly well as a procedural or “script” language, where one command is executed after another, like a recipe. But getting familiar with OOP will not only help you read other Python code, but it will help you learn to encapsulate your code into objects for better organization and readability, as well as increase efficiency by making your code easily reusable. Objects are center-stage in Python, representing not only the data, but the overall structure of your programs as well.