Get one quick Python tip each week Weekly Python advice: one quick Python tip every week

Function overloading PREMIUM

Series: Functions
Trey Hunner smiling in a t-shirt against a yellow wall
Trey Hunner
4 min. read 3 min. video Python 3.8—3.11
Python Morsels
Watch as video
02:54

Python doesn't have function overloading.

Instead of overloading we have overwriting

What if we have a function that we'd like to use with different arguments depending on the situation?

For example, we'd like to make a greet function that can be called with nothing or can be called with a single argument:

...

A Python Tip Every Week

Need to fill-in gaps in your Python skills? I send weekly emails designed to do just that.

Python Morsels
Watch as video
02:54