PYnative

Python Programming

  • Learn Python
    • Python Tutorials
    • Python Basics
    • Python Interview Q&As
  • Exercises
    • Python Exercises
    • C Programming Exercises
    • C++ Exercises
  • Quizzes
  • Code Editor
    • Online Python Code Editor
    • Online C Compiler
    • Online C++ Compiler
Home » Python » Python Object-Oriented Programming (OOP) » Polymorphism in Python

Polymorphism in Python

Updated on: October 21, 2021 | 15 Comments

Object-Oriented Programming (OOP) has four essential characteristics: abstraction, encapsulation, inheritance, and polymorphism.

This lesson will cover what polymorphism is and how to implement them in Python. Also, you’ll learn how to implement polymorphism using function overloading, method overriding, and operator overloading.

Table of contents

  • What is Polymorphism in Python?
    • Polymorphism in Built-in function len()
  • Polymorphism With Inheritance
    • Example: Method Overriding
    • Overrride Built-in Functions
  • Polymorphism In Class methods
    • Polymorphism with Function and Objects
  • Polymorphism In Built-in Methods
  • Method Overloading
  • Operator Overloading in Python
    • Overloading + operator for custom objects
    • Overloading the * Operator
    • Magic Methods

What is Polymorphism in Python?

Polymorphism in Python is the ability of an object to take many forms. In simple words, polymorphism allows us to perform the same action in many different ways.

For example, Jessa acts as an employee when she is at the office. However, when she is at home, she acts like a wife. Also, she represents herself differently in different places. Therefore, the same person takes different forms as per the situation.