Daily Dose of Data Science

Share this post

How To Enable Function Overloading In Python

www.blog.dailydoseofds.com

Discover more from Daily Dose of Data Science

High-quality insights on Data Science and Python, along with best practices — shared daily. Get a free 550+ page data science PDF guide and 450+ practice questions notebook.
Over 49,000 subscribers
Continue reading
Sign in

How To Enable Function Overloading In Python

Avi Chawla
Feb 20, 2023
5
Share this post

How To Enable Function Overloading In Python

www.blog.dailydoseofds.com
Share

Python has no native support for function overloading. Yet, there's a quick solution to it.

Function overloading (having multiple functions with the same name but different number/type of parameters) is one of the core ideas behind polymorphism in OOP.

But if you have many functions with the same name, python only considers the latest definition. This restricts writing polymorphic code.

Despite this limitation, the dispatch decorator allows you to leverage function overloading.

Find more info here: Multipledispatch.

Share this post on LinkedIn: Post Link.

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new about Python and Data Science every day.


Hey there!

I am actively looking for opportunities to expand the audience of this daily publication. If you have been benefitted in any way from the posts I share, I would really appreciate it if you could spread the word.

  • You can write about it on social media.

  • If you are a student, please share it with your friends.

  • If you are a professional, please share it with your colleagues.

In either case, I would also appreciate it if you could reply with the email address of someone from academics of your college/school (or a member of your team at work) whom I can get in touch with to spread the word to all students (or team members) of your college/school (or workplace).

Thanks!


Find the code for my tips here: GitHub.

I like to explore, experiment and write about data science concepts and tools. You can read my articles on Medium. Also, you can connect with me on LinkedIn.

5
Share this post

How To Enable Function Overloading In Python

www.blog.dailydoseofds.com
Share
Previous
Next
Comments
Top
New
Community

No posts

Ready for more?

© 2023 Avi Chawla
Privacy ∙ Terms ∙ Collection notice
Start WritingGet the app
Substack is the home for great writing