從熟悉 Python 到貢獻 CPython:第一個 PR 的切入指南

Peter

Kalyan Prasad
Python descriptors are one of the quietest but most powerful mechanisms in the language. They power familiar features like methods, property, class attributes, validation patterns, and many framework APIs, yet many Python developers only encounter them indirectly.
In this talk, we will demystify descriptors by building them from first principles. We will start with the attribute lookup model, then implement simple descriptors for validation, computed fields, and reusable API design. Along the way, we will connect descriptors to real-world patterns used in ORMs, configuration objects, and framework internals.
Attendees will leave with a clear mental model of get, set, and set_name, and a practical understanding of when descriptors make code cleaner, and when a simpler tool is enough.
Python often feels elegant because complex behavior can be hidden behind simple attribute access. You write user.email, model.field, or obj.method() and the interface feels natural. Behind many of these APIs is a protocol called the descriptor protocol.
This talk introduces descriptors as a practical design tool, not just a language curiosity. We will explore how Python resolves attributes, why functions become bound methods, how property works, and how custom descriptors can help create reusable validation and computed-field behavior.
The talk will be example-driven. We will begin with a plain class, identify duplication in common validation logic, and gradually refactor toward descriptors. Then we will look at how the same idea appears in larger Python ecosystems such as ORMs, web frameworks, and data modeling libraries.
The goal is not to convince everyone to use descriptors everywhere. Instead, the talk gives Python developers a sharper tool for understanding the language and recognizing when descriptors are the right abstraction for building clean APIs.

Kalyan Prasad is a AI & Data Science Practice Lead, diversity and inclusion advocate at PSF, Chair of PyConf Hyderabad, and Lead Organizer of HydPy. He actively contributes to global Python communities through mentoring, speaking, and community leadership, and received the Q2 2026 Community Service Award from the Python Software Foundation for outstanding contributions to the Python ecosystem.

Peter

scc

Xavier Yen (顏志穎)