[Tutor] about reload
Luke Paireepinart
rabidpoobear at gmail.com
Fri Dec 29 23:48:42 CET 2006
Danny Yoo wrote:
> On Fri, 29 Dec 2006, linda.s wrote:
>
>
>> I read something about reload of modules.
>> #test.py
>> from ABC import M # M is an attribute of Module ABC
>>
>> if I change module ABC, I need import ABC and reload ABC before "from
>> ABC import M" work. in IDLE, I just click F5 and run the code, it works
>> and does not need type anything like "Import ABC", "Reload(ABC)". Why
>> the book say the two steps are needed?
>>
>
> reload() is necessary if we don't re-run everything from scratch.
>
> When you're pressing F5 in IDLE, IDLE restarts the whole program, so in
> that particular case, you don't need to worry about reload() at all.
>
Actually, if you have IDLE in the default setup on Windows and you
right-click something to edit it,
IDLE doesn't open a subprocess each time a script is executed, so it
will keep the imports in between runs of the program.
I.E. if I type "import math" into the IDLE interpreter, I can then make
a file with the contents
#---- start
print math.pi
#----- end
and it will work.
just thought I'd mention that.
> _______________________________________________
> Tutor maillist - Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
>
More information about the Tutor
mailing list