also applies to if new-style classes are used other attribute management tools these three attribute-access overloading methods allow you to control or specialize access to attributes in your objects they tend to play highly specialized rolessome of which we'll explore later in this book for another example of __getattr__ at worksee ' person-composite py and for future referencekeep in mind that there are other ways to manage attribute access in pythonthe __getattribute__ method intercepts all attribute fetchesnot just those that are undefinedbut when using it you must be more cautious than with __get attr__ to avoid loops the property built-in function allows us to associate methods with fetch and set operations on specific class attribute descriptors provide protocol for associating __get__ and __set__ methods of class with accesses to specific class attribute slots attributes are declared in classes but create implicit storage in each instance because these are somewhat advanced tools not of interest to every python programmerwe'll defer look at properties until and detailed coverage of all the attribute management techniques until emulating privacy for instance attributespart as another use case for such toolsthe following code--file private py--generalizes the previous exampleto allow each subclass to have its own list of private names that cannot be assigned to its instances (and uses user-defined exception classwhich you'll have to take on faith until part vii)class privateexc(exception)pass class privacydef __setattr__(selfattrnamevalue)if attrname in self privatesraise privateexc(attrnameselfelseself __dict__[attrnamevalue more on exceptions in part vii on self attrname value makeraise user-define except avoid loops by using dict key class test (privacy)privates ['age'class test (privacy)privates ['name''pay'def __init__(self)self __dict__['name''tom operator overloading to do bettersee