First Timer

Terry Reedy tjreedy at udel.edu
Tue May 11 17:37:53 EDT 2010


On 5/11/2010 3:28 PM, Donna Lane wrote:
> I have downloaded Python and I'm a beginner in every sense.

Welcome. I hope you enjoy Python too.

 > What I want to
> know now is when I am in Idle and have made a syntax error how do I repair?
> After the error I can't type in anything and I get this bing noise.
 > Usually I just start idle over again.

You cannot directly repair a line already <enter>ed. You must enter a 
new line. In the command line interpreter, you should be able to hit up 
arrow and have the line above copied to the current entry line for 
correction. In IDLE, this does not yet work, so copy and paste or retype.

For anything too complicated for either of those (more than one line), I 
use (and reuse) a temporary edit file in an edit window. Just make sure 
the file is named <something>.py rather than just <something>. You save 
and run the file with F5. If there is a syntax error, IDLE will say so 
and reopen the cursor window with the cursor at (or after) the location 
of the error. Fix and hit F5 again. Very fast.

The main thing to watch is that you must say 'print(x)' rather than just 
'x' to print. File/Recent files lets one easily reopen the tem file (or 
any other of the 20 most recently edited files).

I use the tem file when I copy and paste more than a single line of code 
from, say, a post here.

Terry Jan Reedy





More information about the Python-list mailing list