What is the difference between a data descriptor and a non-data descriptor?
Properties, descriptors, and slots
Audio flashcard · 0:17Nortren·
What is the difference between a data descriptor and a non-data descriptor?
0:17
A data descriptor defines both dunder get and dunder set, possibly also dunder delete. A non-data descriptor defines only dunder get. Data descriptors take precedence over instance attributes during lookup, while instance attributes take precedence over non-data descriptors. Properties are data descriptors.
docs.python.org