Daily Dose of Data Science

Share this post

Modify a Function During Run-time

www.blog.dailydoseofds.com

Modify a Function During Run-time

Avi Chawla
Oct 17, 2022
2
Share

Have you ever been in a situation where you wished to add more details to an already running code?

This is typically observed in ML where one often forgets to print all the essential training details/metrics. Executing the entire code again, especially when it has been up for some time is not an ideal approach here.

If you want to modify a function during execution, decorate it with the reloading decorator (@𝐫𝐞𝐥𝐨𝐚𝐝𝐢𝐧𝐠). As a result, Python will reload the function from the source before each execution.

Link to reloading: GitHub.

Thanks for reading Daily Dose of Data Science! Subscribe for free to learn something new and insightful about Python and Data Science every day. Also, get a Free Data Science PDF (250+ pages) with 200+ tips.


Read this post on LinkedIn here: Link.

2
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