[Tutor] IDLE as battery included

Kirby Urner urnerk@qwest.net
Mon, 26 Nov 2001 15:16:56 -0800


At 05:09 PM 11/26/2001 -0500, Andrei Kulakov wrote:

>I think it'd be preferable to use some simple notepad-like editor with
>syntax colors. I think notepad+ and ultraedit both have that.

Perhaps.  Ultraedit looks good, but you'd have to set it up
for Python I think (maybe setup file is sharable? -- someone
has it?) -- not one of the canned languages, at least not
on the web page I saw.  Costs $30 (IDLE free).  Notepad+ has
its limitations too.

The thing about IDLE is it has access to a primitive graphical
debugger (not industrial strength by any means, but a beginner
is still able to learn from it), is aware of the Python path
(go Open Module and enter just the module name, and it'll
get retrieved, if anywhere on the path).  Plus you can execute
a .py file by going Ctrl-5 in the text editor window.  In
other words, it works more intimately with Python, and as a
shell.

With these editors, you still want to have a shell open (a
Python shell, not an Xterm or OS window), so you can do the
reload/interact cycle.

> >
> > That cut 'n paste weirdness had never come up for me before
>
>The problem is that when you type in blocks, they're unaligned, and that
>just don't look right.

When you type the blocks directly at the IDLE prompt, it's
not a problem.  When I go:

 >>> def f(x):

and hit enter, the cursor goes to the next line and sits under
the f, indented, waiting for a next line.

It's cutting and pasting that might be a problem.  If I cut

def fib():
     """
     Simple generator from documentation:  yield
     successive Fibonacci numbers
     """
     a, b = 0, 1
     while 1:
        yield b
        a, b = b, a+b

and paste it to the >>>, I get:

 >>> def fib():
     """
     Simple generator from documentation:  yield
     successive Fibonacci numbers
     """
     a, b = 0, 1
     while 1:
        yield b
        a, b = b, a+b

Now if I go and insert spaces in front of lines below the
def, it still works, cuz what's already seen as indented
by IDLE, is indented even more by me.

>Besides, when a newbie is trying to follow the book and it don't work,
>that ain't good either :P.
>
>  - Andrei

Yeah, this I agree with.  Pitfalls.  IDLE should be fixed
and/or other shells developed.  I'm just not sure I'd
counsel newbies to foresake IDLE in favor of the options
mentioned above.  It still has quite a bit going for it.

Ultimately, it's not an either/or proposition.  Use IDLE
sometimes, but find a good program editor, preferably one
you can use with other languages too, since Python
shouldn't be the only language you ever use.

Kirby