Python · The Python Data Model · Advanced · 30 min read
Python Descriptors and Attribute Access: __get__, __set__, Properties, __getattr__ and Validated Fields
Understand how attribute access really works. Learn the attribute lookup algorithm, the descriptor protocol (__get__, __set__, __delete__, __set_name__), data versus non-data descriptors, how functions become bound methods and how property and cached_property work, write reusable validators and lazy attributes, use __getattr__, __getattribute__ and __setattr__ correctly, and avoid the common traps.
Create an account to start
Create a free account to see what this lesson covers
- Every free lesson in every section, in full
- Track your progress and pick up where you left off
- Free practice questions and an incident simulation
- Takes under a minute: name, email and a password
No card needed. Full access to Python is a paid upgrade you can choose later.