[Tutor] using IDLE and changing variables

alan.gauld@bt.com alan.gauld@bt.com
Mon, 30 Jul 2001 10:21:58 +0100


> when you make changes to a module that you are importing, 
> the changes won't be recognized unless you force a reload 

Correct, at the interactive prompt.

> Let's say at one point you had a variable x defined 
> and you used it in several places.  Then you change 
> the variable from x to y but forget to change it 
> everywhere.  

That'd be a programmer error in every environment I've 
ever used. Some language compilers will tell you if you 
remove the original declaration/definition of the variable 
(x in your case) and then try to use it. Python will 
warn you in some situations. But it has nothing to do 
with IDLE per se, it's all to do with Python itself.

> I guess what I'm looking for is something like BASIC's "new" 
> command that flushes out everything of the session and begins 
> fresh.

The interactive prompt doesn't have that feature but 
working in IDLE the best thing IMHO is simply to create 
a new file using File|New...

The >>> prompt is great for playing with ideas but if 
its more than a few lines of code I prefer to work in 
a file and edit/save/run - even if the file is just 
a throw-away like tmp.py of foo.py or whatever.

Alan G