2018 | OriginalPaper | Buchkapitel
5. Attribute Access and Descriptors
Aktivieren Sie unsere intelligente Suche, um passende Fachinhalte oder Patente zu finden.
Wählen Sie Textabschnitte aus um mit Künstlicher Intelligenz passenden Patente zu finden. powered by
Markieren Sie Textabschnitte, um KI-gestützt weitere passende Inhalte zu finden. powered by
Abstract
__getattribute__()
, __setattr__()
, and __delattr__()
do it. That probably isn't much of an answer for you, so I'll dig into it more. These three methods exist on all normal objects, inherited via the object class (and classes inherit it from the type metaclass). As you might imagine, these methods are called when an attribute on an object is retrieved, set, or deleted, respectively, and it is these methods that decide whether to use a descriptor, __dict__
, or __slots__
, and whether to return/set something on the class or on the instance.