polymorphism ("many shapes"polymorphism is an important feature of class definition in python that is utilized when you have commonly named methods across classes or subclasses this permits functions to use entities of different types at different times soit provides flexibility and loose coupling so that code can be extended and easily maintained over time this allows functions to use objects of any of these polymorphic classes without needing to be aware of distinctions across the classes polymorphism can be carried out through inheritancewith subclasses making use of base class methods or overriding them let understand the concept of polymorphism with our previous inheritance example and add one common method called show_affection in both subclassesfrom the example we can seeit refers to design in which object of dissimilar type can be treated in the same manner or more specifically two or more classes with method of the same name or common interface because same method(show_affection in below exampleis called with either type of objects output soall animals show affections (show_affection)but they do differently the "show_affectionbehaviors is thus polymorphic in the sense that it acted differently depending on the animal sothe abstract "animalconcept does not actually "show_affection"but specific animals(like dogs and catshave concrete implementation of the action "show_affection