Packt

Python Data Model

Packt

Python Data Model

Included with Coursera Plus

Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

2 weeks to complete
at 10 hours a week
Flexible schedule
Learn at your own pace
Gain insight into a topic and learn the fundamentals.
Intermediate level

Recommended experience

2 weeks to complete
at 10 hours a week
Flexible schedule
Learn at your own pace

What you'll learn

  • Implement custom object behaviors using Python’s data model protocols.

  • Use special methods to manage object representation, creation, and deletion.

  • Build dictionary-like custom objects with iterable behavior.

  • Master custom numeric operators and implement complex math operations.

Details to know

Shareable certificate

Add to your LinkedIn profile

Recently updated!

May 2026

Assessments

9 assignments

Taught in English

See how employees at top companies are mastering in-demand skills

 logos of Petrobras, TATA, Danone, Capgemini, P&G and L'Oreal

There are 8 modules in this course

In this module, we will explore the essential building blocks of Python's data model, focusing on object creation, initialization, and how to represent objects in custom ways. You’ll also learn to control object deletion behavior using the __del__ method. These foundational skills will help you create flexible and reusable Python classes.

What's included

6 videos

In this module, we will dive into how custom objects can behave like built-in containers, such as lists or dictionaries. You'll learn to make your objects iterable and give them the ability to store and manipulate items like a dictionary. This module will expand your Python class design skills by integrating custom data structures.

What's included

3 videos1 assignment

In this module, we will cover how to make custom objects comparable, enabling equality checks and Boolean evaluations. You'll also learn how to define the ordering of objects, allowing them to be compared using greater than, less than, and equality operators. These comparisons make your objects more versatile and integrated with Python’s built-in systems.

What's included

4 videos1 assignment

In this module, we will focus on enabling custom objects to perform arithmetic and bitwise operations. You’ll learn how to override operators like addition and subtraction to work with your own types. Additionally, we’ll explore customizing operations like modulo, powers, and bit-shifting, bringing your objects closer to behaving like numeric types.

What's included

14 videos1 assignment

In this module, we will explore how to control and manipulate object attributes. You’ll learn how to intercept and customize the behavior when reading, setting, and deleting attributes. Additionally, we will cover descriptors and the property decorator, which allows you to add custom logic to your object’s attributes.

What's included

4 videos1 assignment

In this module, we will explore how to make custom objects behave like functions. By using the __call__ method, you can turn your objects into callable entities, enabling dynamic and flexible design patterns. This skill is useful for when your objects need to function as both data structures and functional components.

What's included

1 video1 assignment

In this module, we will focus on using context managers in Python. You will learn how to define custom context managers using __enter__ and __exit__ to manage resources such as file handles or database connections. This will help you write cleaner, more efficient code for managing resources with automatic cleanup.

What's included

1 video1 assignment

In this module, we will cover the advanced topic of object serialization. You’ll learn how to copy objects effectively and explore the differences between shallow and deep copies. Additionally, you will learn how to use the pickle module to save and load objects, customizing the serialization process with __getstate__ and __setstate__. This will ensure your custom objects can be easily saved and restored.

What's included

2 videos3 assignments

Instructor

Packt - Course Instructors
Packt
1,810 Courses512,664 learners

Offered by

Packt

Why people choose Coursera for their career

Felipe M.

Learner since 2018
"To be able to take courses at my own pace and rhythm has been an amazing experience. I can learn whenever it fits my schedule and mood."

Jennifer J.

Learner since 2020
"I directly applied the concepts and skills I learned from my courses to an exciting new project at work."

Larry W.

Learner since 2021
"When I need courses on topics that my university doesn't offer, Coursera is one of the best places to go."

Chaitanya A.

"Learning isn't just about being better at your job: it's so much more than that. Coursera allows me to learn without limits."

Frequently asked questions