# Polymorphism

*noun*

say it: **“pol-ee-MOR-fiz-um”** **/ˌpɒliˈmɔːrfɪzəm/**

Different kinds of objects answering the same method call each in their own way, so one piece of code can work with all of them.

## What is **polymorphism**?

**Polymorphism** means different objects can answer the same method call in their own way, so one piece of code can work with all of them.

```python
class Card:
    def pay(self, amount):
        print(f"Charged ${amount} to card")

class Cash:
    def pay(self, amount):
        print(f"Took ${amount} in cash")

for method in [Card(), Cash()]:
    method.pay(20)
```

## In a sentence

- “Thanks to **polymorphism**, the checkout calls pay() without caring if it's a card or cash.”
- “**Polymorphism** let one loop draw circles, squares and triangles with the same draw() call.”

Level: Journeyman · [More Python terms at this level](https://www.ask-codey.com/glossary?category=python&level=3)

Updated: November 19, 2026

## In other subjects

- [Polymorphism in C#](https://www.ask-codey.com/glossary/polymorphism-c-sharp)
- [Polymorphism in Java](https://www.ask-codey.com/glossary/polymorphism-java)
- [Polymorphism in JavaScript](https://www.ask-codey.com/glossary/polymorphism-javascript)
- [Polymorphism in OOP](https://www.ask-codey.com/glossary/polymorphism-oop)

Source: https://www.ask-codey.com/glossary/polymorphism
