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

Sheila King sheila@thinkspot.net
Thu, 26 Jul 2001 21:18:53 -0700


On Fri, 27 Jul 2001 00:09:08 -0400, dman <dsh8290@rit.edu>  wrote about
Re: [Tutor] Re: Baffled: why doesn't range work?:

:| 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.

OK. That was my problem, then. I originally didn't have the word "range"
in the lines:

            for i in range(1, numRows + 1, 1):
                for j in range(1, numCols + 1, 1):

Failure of the module to reload after I modified the code would
completely explain the output I was getting.

OK, I learned another Python fact today. ;)

--
Sheila King
http://www.thinkspot.net/sheila/
http://www.k12groups.org/