🎁 New User? Get 20% off your first purchase with code NEWUSER20 Register Now →
Menu

Categories

Python Advanced

What is Python Descriptors?

Objects that define __get__, __set__, or __delete__ methods, controlling how attribute access works on other objects.

Descriptors are the mechanism behind properties, class methods, static methods, and slots in Python. When an object defines __get__(), __set__(), or __delete__(), it becomes a descriptor. Data descriptors (with __set__ or __delete__) take precedence over instance dictionaries, while non-data descriptors (only __get__) defer to instance attributes. This protocol powers Django ORM fields, SQLAlchemy columns, and validation frameworks. Understanding descriptors reveals how Python's attribute access truly works — when you access obj.attr, Python calls type(obj).__dict__['attr'].__get__(obj, type(obj)) if attr is a descriptor.

Related Terms

Python Wheel
A built distribution format (.whl) that allows faster installation of Python packages by avoiding the need for compilation.
Python Interpreter
The program that reads and executes Python code, translating it into machine instructions at runtime.
Python Profiling
Measuring where Python code spends time and memory to identify performance bottlenecks and optimization opportunities.
Logging Module
Python's built-in module for recording diagnostic information with configurable handlers, formatters, and log levels.
Pandas
A powerful data analysis and manipulation library providing DataFrames and tools for working with structured data.
Matplotlib
A comprehensive plotting library for creating static, animated, and interactive visualizations in Python.
View All Python Terms →