Reload() Confusion

David MacQuigg dmq at gain.com
Fri Mar 12 19:37:16 EST 2004


I'm going to be teaching EEs some basic Python using the first few
chapters of Learning Python, 2nd ed. by Mark Lutz.  The discussion on
Reloading Modules starting on page 266 is confusing and I believe
incorrect.  On page 266 it says that a reload "changes the existing
module object in place."  That's a little vague, but on page 267 it
says "every reference to a module object anywhere in your program is
automatically affected by a reload."

It is my understanding that the reloaded objects become *new* objects
in memory, available only via a fully-qualified reference to the new
module.  The old objects remain in memory until the last reference to
them is gone.

I've re-written the section on Reload Basics, and I would like to get
some comments, both on correctness and clarity.

http://ece.arizona.edu/~edatools/Python/Reload.htm

Your help will be appreciated, both by me and by the students
struggling through this the first time.

-- Dave




More information about the Python-list mailing list