exampleif engineers have unique salary computation rule (perhaps it' not hours times rate)you can replace just that one method in subclassclass engineer(employee)def computesalary(self)specialized subclass something custom here because the computesalary version here appears lower in the class treeit will replace (overridethe general version in employee you then create instances of the kinds of employee classes that the real employees belong toto get the correct behaviorbob employee(sue employee(tom engineer(default behavior default behavior custom salary calculator notice that you can make instances of any class in treenot just the ones at the bottom --the class you make an instance from determines the level at which the attribute search will beginand thus which versions of the methods it will employ ultimatelythese three instance objects might wind up embedded in larger container object--for instancea listor an instance of another class--that represents department or company using the composition idea mentioned at the start of this when you later ask for these employeessalariesthey will be computed according to the classes from which the objects were madedue to the principles of the inheritance searchcompany [bobsuetomfor emp in companyprint(emp computesalary() composite object run this object' versiondefault or custom this is yet another instance of the idea of polymorphism introduced in and expanded in recall that polymorphism means that the meaning of an operation depends on the object being operated on that iscode shouldn' care about what an object isonly about what it does herethe method computesalary is located by inheritance search in each object before it is called the net effect is that we automatically run the correct version for the object being processed trace the code to see why in other applicationspolymorphism might also be used to hide ( encapsulateinterface differences for examplea program that processes data streams might be coded to expect objects with input and output methodswithout caring what those methods actually dodef processor(readerconverterwriter)while truedata reader read( the company list in this example could be database if stored in file with python object picklingintroduced in to make the employees persistent python also comes with module named shelvewhich allows the pickled representation of class instances to be stored in an access-by-key filesystemwe'll deploy it in oop from , feet