Packt

Python Data Model

享受 3 個月的 Coursera Plus 40% 的折扣,節省讓您 閃耀的技能。立即保存

Packt

Python Data Model

包含在 Coursera Plus

深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度
深入了解一个主题并学习基础知识。
中级 等级

推荐体验

2 周 完成
在 10 小时 一周
灵活的计划
自行安排学习进度

您将学到什么

  • 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.

要了解的详细信息

可分享的证书

添加到您的领英档案

最近已更新!

May 2026

作业

9 项作业

授课语言:英语(English)

了解顶级公司的员工如何掌握热门技能

Petrobras, TATA, Danone, Capgemini, P&G 和 L'Oreal 的徽标

该课程共有8个模块

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.

涵盖的内容

6个视频

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.

涵盖的内容

3个视频1个作业

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.

涵盖的内容

4个视频1个作业

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.

涵盖的内容

14个视频1个作业

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.

涵盖的内容

4个视频1个作业

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.

涵盖的内容

1个视频1个作业

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.

涵盖的内容

1个视频1个作业

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.

涵盖的内容

2个视频3个作业

位教师

Packt - Course Instructors
Packt
1,810 门课程512,664 名学生

提供方

Packt

人们为什么选择 Coursera 来帮助自己实现职业发展

Felipe M.

自 2018开始学习的学生
''能够按照自己的速度和节奏学习课程是一次很棒的经历。只要符合自己的时间表和心情,我就可以学习。'

Jennifer J.

自 2020开始学习的学生
''我直接将从课程中学到的概念和技能应用到一个令人兴奋的新工作项目中。'

Larry W.

自 2021开始学习的学生
''如果我的大学不提供我需要的主题课程,Coursera 便是最好的去处之一。'

Chaitanya A.

''学习不仅仅是在工作中做的更好:它远不止于此。Coursera 让我无限制地学习。'

常见问题