AI engineering glossary · Python advanced
What is descriptor?
Descriptor: An object defining __get__, __set__ or __delete__ that controls how an attribute is read or written when it sits in a class. Properties, methods and many ORM fields are built on this protocol.
Descriptor: an example
A Positive descriptor whose __set__ raises ValueError for negative numbers can guard several attributes across classes.
Related terms
More Python advanced terms
- Duck typing
- Dunder method
- Encapsulation
- Fixture
- functools
- functools.lru_cache
- functools.partial
- functools.wraps
Where you learn it
Descriptor is part of the AI Engineering Program, which teaches it with notes, a hands-on lab and an exam. The first lesson is free.