decorator this is why this extension is omitted in our codethere are potentially more than such methodsbecause all its classes are new-styledelegation-based code is more difficult--though not necessarily impossible--in python implementation alternatives__getattribute__ insertscall stack inspection although redundantly defining operator overloading methods in wrappers is probably the most straightforward workaround to python dilemma outlined in the prior sectionit' not necessarily the only one we don' have space to explore this issue much further hereso deeper investigation will have to be relegated to suggested exercise because one dead-end alternative illustrates class concepts wellthoughit merits brief mention one downside of the privacy example is that instance objects are not truly instances of the original class--they are instances of the wrapper instead in some programs that rely on type testingthis might matter to support such caseswe might try to achieve similar effects by inserting __getattribute__ and __setattr__ method into the original classto catch every attribute reference and assignment made on its instances these inserted methods would pass valid requests up to their superclass to avoid loopsusing the techniques we studied in the prior here is the potential change to our class decorator' codemethod insertionrest of access py code as before def accesscontrol(failif)def ondecorator(aclass)def getattributes(selfattr)trace('get:'attrif failif(attr)raise typeerror('private attribute fetchattrelsereturn object __getattribute__(selfattrdef setattributes(selfattrvalue)trace('set:'attrif failif(attr)raise typeerror('private attribute changeattrelsereturn object __setattr__(selfattrvalueaclass __getattribute__ getattributes aclass __setattr__ setattributes return aclass return ondecorator insert accessors return original class this alternative addresses the type-testing issue but suffers from others for one thingthis decorator can be used by new-style class clients onlybecause __getattribute__ is new-style-only tool (as is this __setattr__ coding)decorated classes in must use decorators