[Tutor] IDLE as battery included

Andrei Kulakov ak@silmarill.org
Mon, 26 Nov 2001 18:31:43 -0500


On Mon, Nov 26, 2001 at 03:16:56PM -0800, Kirby Urner wrote:
> 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.

I don't know why, but I prefer to have a second shell open anyway to run
scripts in even though they can be run from inside vim. I guess it's
cause I want it open to use mutt when new mail comes in, and occasional
file management, and that sort of thing..

> 
> >>
> >> 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.

You're right, it's much better with functions, so the only problem is
with if/else blocks, where if isn't aligned with else. It's not nearly
as bad as I thought at first, since you don't need to use if/else blocks
very often outside of functions.

> 
> >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.

I don't know about emacs, but vim can do everything much better than
idle, except for debugging, so I'd use it exclusively (and I do). But
then again, I never like debuggers so it's a matter of taste I suppose.

> 
> Kirby
> 
> 
> _______________________________________________
> Tutor maillist  -  Tutor@python.org
> http://mail.python.org/mailman/listinfo/tutor

-- 
Cymbaline: intelligent learning mp3 player - python, linux, console.
get it at: cy.silmarill.org