Real-life module reloading in Python?

Viewed 96

I am going through a book on Python which spends a decent time on module reloading, but does not explain well when it would be useful.

Hence, I am wondering, what are some real-life examples of when such technique becomes handy?

That is, I understand what reloading does. I am trying to understand how one would use it in real world.

Edit:

I am not suggesting that this technique is not useful. Instead, I am trying to learn more about its applications as it seems quite cool.

Also, I think people who marked this question as duplicate took no time to actually read the question and how it is different from the proposed duplicate. I am not asking HOW TO reload a module in Python. I already know how to do that. I am asking WHY one would want to reload a module in Python in real life. There is a huge difference in nature of these questions.

2 Answers

As an appendix to DYZ's answer, I use module reloading when analysing large data in interactive Python interpreter.

Loading and preprocessing of the data takes some time and I prefer to keep them in the memory (in a module BTW) rather than restart the interpreter every time I change something in my modules.

Related