Reloading a module

Jeff Epler jepler at unpythonic.net
Tue Oct 1 07:39:15 EDT 2002


So you're not worried that names defined in the new version of the module
aren't being created, but that names defined in the old version (but not
the new one) will persist?

Then why not define a wrapper around reload (untested)?
    def my_reload(module):
	for k in module.__dict__.keys():
	    if k in ('__file__', '__name__'): continue
	    del module.__dict__[k]
	return reload(module)

Jeff




More information about the Python-list mailing list