Daily Dose of Data Science

Share this post

Simplify Your Functions With Partial Functions

www.blog.dailydoseofds.com

Simplify Your Functions With Partial Functions

Avi Chawla
Dec 18, 2022
2
Share

When your function takes many arguments, it can be a good idea to simplify it by using partial functions.

They let you create a new version of the function with some of the arguments fixed to specific values.

This can be useful for simplifying your code and making it more readable and concise. Moreover, it also helps you avoid repeating yourself while invoking functions.

Share this post on LinkedIn: Link.

Thanks for reading Daily Dose of Data Science! Subscribe for free to receive new posts and support my work.


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.

2
Share
Previous
Next
2 Comments
Len Kinder
Writes Cataclysmic Earth History
Dec 18, 2022

I wish I had time to do Logo again (turtle graphics).

Here's my weekly dose of science: https://www.thunderbolts.info/forum3/phpBB3/viewtopic.php?f=5&t=26&p=8469#p8469

And a less frequent dose: https://substack.com/profile/98340589-len-kinder

Expand full comment
Reply
Max Storr
Dec 18, 2022

def quadratic(x, a, b, c = 1): achieves the same thing without requiring an import right?

Expand full comment
Reply
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