<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:courier,monaco,monospace,sans-serif;font-size:12pt"><div style="font-family: courier,monaco,monospace,sans-serif; font-size: 12pt;">Well, after some experimenting on my laptop (Running Ubuntu 7.0.4 with Python 2.5.1), I've narrowed it down to this:<br><br>1.&nbsp; If I start IDLE from usr/bin through the terminal , it appears to run in "normal" mode.<br>2.&nbsp; If I start with the icon from Gnome menu applications/programming/IDLE, it does NOT start in "normal" mode, but of course you can go into system/main menu/launcher properties (rt. click) and take the "-n" off.&nbsp; Any reason why that is the default, though?<br><br>What I did was declare a variable in the shell mode, then run a simple script that attempted to print that variable without declaring it first.&nbsp; In "-n" mode it would print "Assigned in shell" or whatever I had assigned to it
 in the shell.&nbsp; In "regular" mode, though, it would raise a traceback error ("a" is not defined).<br><br>What I find interesting, though, is that in both cases ("-n" and "normal") you are still able to access variables that have just run in a program after the program is done running.&nbsp; For instance, if I run a program that declares a="assigned in program", I can later print out that variable in shell mode.<br><br>So I've worked several Python books and tutorials, written both functional programs and some OOP, and yet I find myself not real clear on what exactly IDLE is ... :-(<br><br>Ah well, at least my ubuntu menu launches IDLE in "normal" mode now. :-)<br><br>Richard<br><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;">----- Original Message ----<br>From: John Zelle &lt;john.zelle@wartburg.edu&gt;<br>To: edu-sig@python.org<br>Cc: Richard Guenther &lt;heistooheavy@yahoo.com&gt;<br>Sent: Wednesday, August 15,
 2007 9:13:32 AM<br>Subject: Re: [Edu-sig] Using IDLE with students<br><br><div><br><br>On Wednesday 15 August 2007 9:04 am, Richard Guenther wrote:<br>&gt; Sorry if this is a bit simplistic:<br>&gt;<br>&gt; When teaching Python to beginners and using IDLE, it seems that one of the<br>&gt; dangers would be to have them assigning variables in the interactive mode<br>&gt; and then maybe using them in a script they're writing.&nbsp;&nbsp;Then, when they run<br>&gt; the script, the variable is still in memory so the program works--for now.<br><br>&gt; Or, as happened recently "raw_input" gets accidentally assigned to a<br>&gt; string.&nbsp;&nbsp;Then, any programs that end with "raw_input("Press Enter to exit<br>&gt; this program")" will cause an error, even though the program script itself<br>&gt; is fine.<br>&gt;<br>&gt;<br>&gt; Obviously quiting and reloading IDLE will take care of this, but I was<br>&gt; wondering what else may trip up students using
 IDLE.&nbsp;&nbsp;Maybe it would be<br>&gt; nice if IDLE had an option called "Run fresh" that would clear any<br>&gt; variables first....just musing here.<br><br>Provided you start IDLE in the "normal" mode, running scripts should execute <br>in a separate subprocess, so the kinds of interactions you describe here are <br>not really a problem. When running in this mode, you can also do a "restart" <br>under the shell menu, and this will get you a fresh interactive environment.<br><br>The problem is that the default IDLE setup in some environments starts up IDLE <br>with the -n switch that causes it to run without separate subprocesses for <br>scripts. For example, under Windows, if you right-click on a Python program <br>and then select "edit with IDLE" it will open in the no-subprocess mode. I <br>always have my students create a shortcut to IDLE in their working <br>directories and make sure it starts IDLE without the -n switch, and I <br>emphasize
 starting IDLE and then loading programs.<br><br>By the way, another thing that will really help is getting students in the <br>habit of writing scripts as functions and then just calling the function. <br>That way variables are local to the function/script regardless of how IDLE is <br>running (still doesn't solve problems like reassigning built-in functions <br>though).<br><br>--John<br><br>-- <br>John M. Zelle, Ph.D.&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Wartburg College<br>Professor of Computer Science&nbsp;&nbsp;&nbsp;&nbsp;Waverly, IA&nbsp;&nbsp;&nbsp;&nbsp; <br>john.zelle@wartburg.edu&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(319) 352-8360&nbsp;&nbsp;<br></div></div><br></div></div><br>
      <hr size=1>Building a website is a piece of cake. <br>Yahoo! Small Business gives you <a href="http://us.rd.yahoo.com/evt=48251/*http://smallbusiness.yahoo.com/webhosting/?p=PASSPORTPLUS">all the tools to get online.</a></body></html>