The Python Papers

The Python Papers

Share this post

The Python Papers
The Python Papers
Python 3 – Function Overloading with singledispatch
Copy link
Facebook
Email
Notes
More

Python 3 – Function Overloading with singledispatch

Mike Driscoll's avatar
Mike Driscoll
Mar 19, 2025
∙ Paid
6

Share this post

The Python Papers
The Python Papers
Python 3 – Function Overloading with singledispatch
Copy link
Facebook
Email
Notes
More
Share

Python added partial support for function overloading in Python 3.4. They did this by adding a neat little decorator to the functools module called singledispatch.

This decorator will transform your regular function into a single dispatch generic function. Note however that singledispatch only happens based on the first argument’s type. Let’s take a loo…

Keep reading with a 7-day free trial

Subscribe to The Python Papers to keep reading this post and get 7 days of free access to the full post archives.

Already a paid subscriber? Sign in
© 2025 Mike Driscoll
Privacy ∙ Terms ∙ Collection notice
Start writingGet the app
Substack is the home for great culture

Share

Copy link
Facebook
Email
Notes
More