What are the applications of python reload function?

I was curious to know about the reload () function in python, which seems to lead to problems when used without caution.

Why do you want to reload the module and not just stop / start python again?

I am assuming that one application can test changes in a module interactively.

+1


a source to share


3 answers


reload is useful for reloading code that can be changed in a Python module. This usually means a plugin system.

Take a look at this link:



http://www.codexon.com/posts/a-better-python-reload

It will tell you about the flaws of the reboot and a possible fix.

+6


a source


I am assuming that one application can test changes in a module interactively.

This is really the only remedy for this. From Python Documentation :



This is useful if you edited the source file of the module using an external editor and want to try the new version without leaving the Python interpreter.

+4


a source


Adding a link to my new reimport module that was released yesterday. This provides a more complete reimport than built-in reload (). With this reimport, you can be sure that class changes and function updates are reflected in all instances and callbacks.

http://code.google.com/p/reimport/

+1


a source







All Articles