Is there any possible point to reloading a Python module immediately?

Is there any conceivable point to reloading these modules immediately after importing them? This is the code that I was reviewing which made me wonder:

import time
import sys
import os
import string
import pp
import numpy
import nrrd
import smooth as sm
import TensorEval2C as tensPP
import TrackFiber4C as trackPP
import cmpV
import vectors as vects

Edit: I suggested that this might make the creation of .pyc files more likely, but several people pointed out that this happens this first time, every time.


I note that the standard modules are just imported: it's the other modules that are reloaded. I expect whoever wrote this code wanted to be able to easily reload the whole package (so as to get their latest edits). After putting in all these redundant reload calls, the programmer only had to write

>>> reload(package)

to bring things up to date in the interpreter, instead of having to type

>>> reload(package.nrrd)
>>> reload(
>>> reload(package.tensPP)

etc. So please ignore the suggestion that you commit violence against the programmer who wrote this: they are far from the only programmer who's had trouble with reloading of dependencies. Just encourage them to move the reloads to a convenience function.

It is possible that this does cause something to happen; the obvious example is side-effects that happen on import. For instance, a module could log to a file the time and date of every time it is imported.

There is probably no good reason for this, however.

Need Your Help

How to close a tab when a form embedded in it closed?

c# winforms

I have my form embedded on top of the tabpage. When I closed the form which is on top of the tabpage, how do I also make the tabpage close as well?

Browser Sync accross many machines

firefox browser synchronization

Everyone remembers google browser sync right? I thought it was great. Unfortunately Google decided not to upgrade the service to Firefox 3.0. Mozilla is developing a replacement for google browser ...

About UNIX Resources Network

Original, collect and organize Developers related documents, information and materials, contains jQuery, Html, CSS, MySQL, .NET, ASP.NET, SQL, objective-c, iPhone, Ruby on Rails, C, SQL Server, Ruby, Arrays, Regex, ASP.NET MVC, WPF, XML, Ajax, DataBase, and so on.