Developing and testing modules live
Nolan Darilek
nolan at ethereal.dhis.org
Mon Oct 18 01:27:47 EDT 1999
When I develop modules, I prefer testing them immediately after I
write each specific function. One solution I've tried is to run an
instance of the Python interpreter in a shell buffer alongside my
editting in another. When I import the module, test some
functionality and modify the source file, I've discovered that del'ing
and re-importing the module doesn't include the changes. For example,
if I write:
print "Hello, world."
in test.py and import test, I receive the message. If I modify the
message to just "Hello.", delete test and re-import it, it doesn't
even print the message.
To me, deleting and re-importing seemed to be an intuitous way of
reloading my changes, but I seem to be missing some important fact
about how importing works. Granted, I can kill the interpreter and
restart it, but this is a bit slower. Is there a way to quickly reread
the module without restarting?
More information about the Python-list
mailing list