Object-Oriented Programming (OOP) (Learning Path) – Real Python

Learning PathSkills: Python, OOP, Classes, Data Classes, Getters, Setters, Property, super(), Magic Methods, Operator Overloading, SOLID, Inheritance, Composition, Mixin Classes, Factory Pattern

A person with a notebook under their arm, walking towards a technical machine that has concepts of object-oriented programming noted on its parts

You’ll start with the fundamentals of classes and OOP concepts, then build on that with data classes, constructors, and super(). From there, you’ll explore magic methods, managed attributes, inheritance, composition, and design patterns like Factory Method and SOLID.

Object-Oriented Programming (OOP)

Learning Path ⋅ 16 Resources

Getting Started With OOP

Learn what object-oriented programming is and how Python implements it. You’ll get familiar with classes, objects, attributes, and methods.

Title image for Intro to Object-Oriented Programming (OOP) in Python (A person looking at objects and concepts of object-oriented programming feeling happy that they're grasping the fundamentals.)

Title image for Object-Oriented Programming (OOP) in Python (OOP in Python 3)

Title image for Class Concepts: Object-Oriented Programming in Python (Python Classes: The Power of Object-Oriented Programming)

Course

Class Concepts: Object-Oriented Programming in Python

Python uses object-oriented programming to group data and associated operations together into classes. In this video course, you'll learn how to write object-oriented code with classes, attributes, and methods.

Title image for Python Classes - The Power of Object-Oriented Programming (Python Classes: The Power of Object-Oriented Programming)

Building and Customizing Classes

Now that you know the basics, learn how to customize your classes. You’ll work with data classes, different types of constructors, and the super() function for calling parent class methods.

Title image for Using Data Classes in Python (Data Classes in Python 3.7 (And Above))

Course

Using Data Classes in Python

Data classes are one of the new features introduced in Python 3.7. When using data classes, you don't have to write boilerplate code to get proper initialization, representation, and comparisons for your objects.

Title image for Data Classes in Python (Data Classes in Python 3.7 (And Above))

Title image for Using Python Class Constructors (Python Class Constructors: Control Your Object Instantiation)

Course

Using Python Class Constructors

Learn how class constructors work in Python. You'll also explore Python's instantiation process, which has two main steps: instance creation and instance initialization.

Title image for Python Class Constructors: Control Your Object Instantiation (Python Class Constructors: Control Your Object Instantiation)

Title image for Using Multiple Constructors in Your Python Classes (Providing Multiple Constructors in Your Python Classes)

Course

Using Multiple Constructors in Your Python Classes

Learn how to provide multiple constructors in your Python classes. To this end, you'll learn different techniques, such as checking argument types, using default argument values, writing class methods, and implementing single-dispatch methods.

Title image for Supercharge Your Classes With Python super() (Supercharge Your Classes With Python super())

Title image for Supercharge Your Classes With Python super() (Supercharge Your Classes With Python super())

Methods and Magic

Explore the different types of methods Python classes can have and learn how magic methods let you customize how your objects behave with built-in operations.

Title image for OOP Method Types in Python: @classmethod vs @staticmethod vs Instance Methods (Python classmethods, staticmethods, and instance methods)

Title image for Python's Instance, Class, and Static Methods Demystified (Python classmethods, staticmethods, and instance methods)

Title image for Python's Magic Methods in Classes (Python's Magic Methods: Leverage Their Power in Your Classes)

Course

Python's Magic Methods in Classes

Learn what magic methods are in Python, how they work, and how to use them in your custom classes to support powerful features in your object-oriented code.

Title image for Python's Magic Methods: Leverage Their Power in Your Classes (Python's Magic Methods: Leverage Their Power in Your Classes)

Title image for Operator and Function Overloading in Custom Python Classes (Operator and Function Overloading in Python)

Managing Attributes

Control how attributes are accessed and modified on your objects. You’ll learn about getters, setters, and Python’s property() decorator for creating managed attributes.

Title image for Getters and Setters in Python (Getters and Setters: Manage Attributes in Python)

Course

Getters and Setters in Python

Learn what getter and setter methods are, how Python properties are preferred over getters and setters when dealing with attribute access and mutation, and when to use getter and setter methods instead of properties in Python.

Title image for Getters and Setters: Manage Attributes in Python (Getters and Setters: Manage Attributes in Python)

Title image for Managing Attributes With Python's property() (Python's property(): Add Managed Attributes to Your Classes)

Title image for Python's property(): Add Managed Attributes to Your Classes (Python's property(): Add Managed Attributes to Your Classes)

Inheritance and Design Patterns

Learn how to reuse and extend classes through inheritance and composition. Then apply established design patterns like Factory Method and SOLID principles to write well-structured code.

Title image for Inheritance and Internals: Object-Oriented Programming in Python (Inheritance and Internals: Object-Oriented Programming in Python)

Title image for Inheritance and Composition: A Python OOP Guide (Inheritance and Composition: A Python OOP Guide)

Course

Inheritance and Composition: A Python OOP Guide

Learn about inheritance and composition in Python. You'll improve your object-oriented programming (OOP) skills by understanding how to use inheritance and composition and how to leverage them in their design.

Title image for Inheritance and Composition: A Python OOP Guide (Inheritance and Composition: A Python OOP Guide)

Title image for What Are Mixin Classes in Python? (What Are Mixin Classes in Python?)

Tutorial

What Are Mixin Classes in Python?

Learn how to use Python mixin classes to write modular, reusable, and flexible code with practical examples and design tips.

Title image for What Are Mixin Classes in Python? (What Are Mixin Classes in Python?)

Title image for Exploring Mixin Classes in Python (Real Python Podcast E263 Title Image)

Title image for Implementing the Factory Method Pattern in Python (The Factory Method Pattern and Its Implementation in Python)

Title image for Design and Guidance: Object-Oriented Programming in Python (SOLID Principles: Improve Object-Oriented Design in Python)

Course

Design and Guidance: Object-Oriented Programming in Python

Learn about the SOLID principles, which are five well-established standards for improving your object-oriented design in Python. By applying these principles, you can create object-oriented code that is more maintainable, extensible, scalable, and testable.

Title image for SOLID Design Principles: Improve Object-Oriented Code in Python (SOLID Principles: Improve Object-Oriented Design in Python)

Congratulations on completing this learning path! You’ve learned how Python’s object-oriented programming works, from basic classes to inheritance, design patterns, and SOLID principles.

Continue your intermediate Python journey with the next learning path:

Learning Path

Files and File Streams

12 Resources ⋅ Skills: Python, Pathlib, File I/O, Serialization, Encoding, Unicode, PDF, WAV, Context Managers, ZIP Files

You might also be interested in these related learning paths:

Got feedback on this learning path?

« Browse All Learning Paths