Polymorphism in Python
November 13, 2019
In this video, you’ll learn about Polymorphism, one of the important pillars of the object-oriented programming paradigm.
Polymorphism is a technique used in object-oriented programming that allows a function (method) to be redefined numerous times using the same name via two special mechanisms called method override and method overload.
Method override is where a function can be redefined in the same class but with unique function signatures (parameters). Method overload can only occur between two classes where one is inheriting another forming a parent-child relationship. The child class can redefine a method in its parent class, but must have the same signature. One of the useful reasons behind both cases is to provide different behaviors but using the same function name — thus the term polymorphism (poly = many, morp = change).
Since Python is a dynamically typed language, it is merely impossible for method overload to occur since signatures cannot be unique. As a result, polymorphism is usually done using method overload only.
Want to learn more? My recommendations: