Skip to main content
Loading page…
Python Mastery
Chapter 15
Lesson 1 of 3
The Descriptor Protocol
Contents
Notes
Tutor
Concept
What Is the Descriptor Protocol?
Loading activity…
Previous
1 / 9
Continue
Contents
Notes
Discussion
Tutor
28 min
9 activities
0 of 9 done
In this lesson
1
What Is the Descriptor Protocol?
2
Building a Data Descriptor from Scratch
3
How `property` Is Actually a Descriptor
4
Bound Methods Are Non-Data Descriptors
5
Gotcha: Storing State in the Descriptor Itself
6
Implement a Ranged Numeric Descriptor
7
Data vs Non-Data Descriptor Priority
8
Descriptor Method Roles
9
Why `property` is a Data Descriptor
Objectives
Implement a data descriptor with __get__, __set__, and __delete__
Implement a non-data descriptor and explain the MRO lookup difference
Explain how property and bound methods are descriptors under the hood
Build a reusable validated-attribute descriptor that enforces type and range constraints
Chapter 15 · Descriptors, Metaclasses & Class Internals
The Descriptor Protocol
How Classes Are Built
Metaclasses
Previous: Abstract Base Classes & Enums
Next: How Classes Are Built