types and objects attribute wrapping and descriptors subtle aspect of attribute manipulation is that sometimes the attributes of an object are wrapped with an extra layer of logic that interact with the getsetand delete operations described in the previous section this kind of wrapping is accomplished by creating descriptor object that implements one or more of the methods in table keep in mind that descriptions are optional and rarely need to be defined table special methods for descriptor object method description returns an attribute value or raises attributeerror _set_ (self,instance,valuesets the attribute to value _delete_ (self,instancedeletes the attribute _get_ (self,instance,clsthe _get_ () _set_ ()and _delete_ (methods of descriptor are meant to interact with the default implementation of _getattribute_ () _setattr_ ()and _delattr_ (methods on classes and types this interaction occurs if you place an instance of descriptor object in the body of user-defined class in this caseall access to the descriptor attribute will implicitly invoke the appropriate method on the descriptor object itself typicallydescriptors are used to implement the low-level functionality of the object system including bound and unbound methodsclass methodsstatic methodsand properties further examples appear in sequence and mapping methods the methods in table are used by objects that want to emulate sequence and mapping objects table methods for sequences and mappings method description _len_ (selfreturns the length of self _getitem_ (selfkeyreturns self[key_ _setitem_ (selfkeyvaluesets self[keyvalue _delitem_ (selfkey_ _contains_ (self,objdeletes self[keyreturns true if obj is in selfotherwisereturns false here' an examplea [ , , , , , len(ax [ [ del [ in _len_ ( _getitem_ ( _setitem_ ( , _delitem_ ( _contains_ ( the _len_ method is called by the built-in len(function to return nonnegative length this function also determines truth values unless the _bool_ (method has also been defined lib fl ff