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.

Level: advancedTopic: Python advanced

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

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.

Before you go

Take the cheat sheet with you

One free PDF: the key AI-engineering terms, formulas and Python idioms. No spam; unsubscribe any time.