Reloading a module

Jeff Epler jepler at
Tue Oct 1 13:39:15 CEST 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)


More information about the Python-list mailing list