[Tutor] Reload() in v3? WAS Re: IDEs

Alan Gauld alan.gauld at btinternet.com
Sat Nov 27 16:11:53 CET 2010


"Alan Gauld" <alan.gauld at btinternet.com> wrote
> Has reload been removed in V3?
> Whats the alternative? Does a repeated import auto-reload?
> 
> I'm surprised and confused...

Found it, its been moved into the imp module.

You need to import imp and then do 

imp.reload(foo)

>>> import os
>>> reload(os)
Traceback (most recent call last):
  File "<pyshell#65>", line 1, in <module>
    reload(os)
NameError: name 'reload' is not defined
>>> import imp
>>> imp.reload(os)
<module 'os' from 'C:\Python31\lib\os.py'>
>>> 

I wonder why that was considered "a good idea"?

Alan G.



More information about the Tutor mailing list