covered in full in but its basic usage is simple enough to leverage here by combining these toolsthe giveraise method here still achieves customizationby changing the argument passed along to the embedded object in effectmanager becomes controller layer that passes calls down to the embedded objectrather than up to superclass methodsfile person-composite py embedding-based manager alternative class personsame class managerdef __init__(selfnamepay)self person person(name'mgr'paydef giveraise(selfpercentbonus )self person giveraise(percent bonusdef __getattr__(selfattr)return getattr(self personattrdef __repr__(self)return str(self personembed person object intercept and delegate delegate all other attrs must overload again (in xif __name__ ='__main__'same the output of this version is the same as the priorso won' list it again the more important point here is that this manager alternative is representative of general coding pattern usually known as delegation-- composite-based structure that manages wrapped object and propagates method calls to it this pattern works in our examplebut it requires about twice as much code and is less well suited than inheritance to the kinds of direct customizations we meant to express (in factno reasonable python programmer would code this example this way in practiceexcept perhaps those writing general tutorials!manager isn' really person hereso we need extra code to manually dispatch method calls to the embedded objectoperator overloading methods like __repr__ must be redefined (in xat leastas noted in the upcoming sidebar "catching built-in attributes in xon page )and adding new manager behavior is less straightforward since state information is one level removed stillobject embeddingand design patterns based upon itcan be very good fit when embedded objects require more limited interaction with the container than direct customization implies controller layeror proxylike this alternative managerfor examplemight come in handy if we want to adapt class to an expected interface it does not supportor trace or validate calls to another object' methods (indeedwe will use nearly identical coding pattern when we study class decorators later in the bookmoreovera hypothetical department class like the following could aggregate other objects in order to treat them as set replace the self-test code at the bottom of the step customizing constructorstoo