Alan Gauld wrote:

import os
reload(os)
Traceback (most recent call last):
 File "<pyshell#65>", line 1, in <module>
   reload(os)
NameError: name 'reload' is not defined


Has reload been removed in V3?

Not removed, just moved.

>>> import imp
>>> imp.reload
<built-in function reload>


The reason for moving it is that reload is quite simple-minded and full of traps for the unwary, and consequently isn't useful enough to be in the build-it namespace.


Whats the alternative? Does a repeated import auto-reload?

Absolutely not! That would make importing much more expensive, and change the behaviour. import(module) caches the module in sys, so that subsequent imports are fast.



--
Steven

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to