methods__get__()__set__()and __delete__()is called (and can be used asa descriptor the built-in property(and classmethod(functions are implemented using descriptors the key to understanding descriptors is that although we create an instance of descriptor in class as class attributepython accesses the descriptor through the class' instances to make things clearlet' imagine that we have class whose instances hold some strings we want to access the strings in the normal wayfor exampleas propertybut we also want to get an xml-escaped version of the strings whenever we want one simple solution would be that whenever string is set we immediately create an xml-escaped copy but if we had thousands of strings and only ever read the xml version of few of themwe would be wasting lot of processing and memory for nothing so we will create descriptor that will provide xml-escaped strings on demand without storing them we will start with the beginning of the client (ownerclassthat isthe class that uses the descriptorclass product__slots__ ("__name""__description""__price"name_as_xml xmlshadow("name"description_as_xml xmlshadow("description"def __init__(selfnamedescriptionprice)self __name name self description description self price price the only code we have not shown are the propertiesthe name is read-only property and the description and price are readable/writable propertiesall set up in the usual way (all the code is in the xmlshadow py file we have used the __slots__ variable to ensure that the class has no __dict__ and can store only the three specified private attributesthis is not related to or necessary for our use of descriptors the name_as_xml and description_as_xml class attributes are set to be instances of the xmlshadow descriptor although no product object has name_as_xml attribute or description_as_xml attributethanks to the descriptor we can write code like this (here quoting from the module' doctests)product product("chisel ""chisel cap" product nameproduct name_as_xmlproduct description_as_xml ('chisel ''chisel &lt; cm&gt;''chisel &ampcap'this works because when we try to accessfor examplethe name_as_xml attributepython finds that the product class has descriptor with that name