[Tutor] Re: Baffled: why doesn't range work?

dman dsh8290@rit.edu
Fri, 27 Jul 2001 00:09:08 -0400


On Thu, Jul 26, 2001 at 08:20:33PM -0700, Sheila King wrote:
| On Thu, 26 Jul 2001 22:10:47 -0500, "Christopher Smith"
| <csmith@blakeschool.org>  wrote about [Tutor] Re: Baffled: why doesn't
| range work?:

| :        import modname
| :        reload(modname)
| 
| Thanks. I did do this:
| 
| del modname
| import modname
| 
| Is that not as good as
| reload(modname)
| 
| ???

Nope -- the 'del' only tweaks the current namespace.  Modules are
never unloaded except when the interpreter exits.  As a result the
subsequent import sees that already loaded module and only performs a
namespace modification.  The reload() instructs the interpreter to
look to the disk to load the module again even though it was already
loaded before.

-D