Discover more from Daily Dose of Data Science
Modify a Function During Run-time
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.