How do you program in Python?

Diez B. Roggisch deets at web.de
Sun Jul 3 12:55:28 EDT 2005


anthonyberet wrote:
> My question isn't as all-encompassing as the subject would suggest...
> 
> I am almost a Python newbie, but I have discovered that I don't get 
> along with IDLE, as i can't work out how to run and rerun a routine 
> without undue messing about.
> 
> What I would really like is something like an old-style BASIC 
> interpreter, in which I could list, modify and test-run sections of 
> code, to see the effects of tweaks, without having to save it each time, 
> or re-typing it over and over (I haven't even worked out how to cut and 
> paste effectively in the IDLE environment).
> 
> I see lots of alternate IDEs etc, but which would allow me the simple 
> interface that I have described? - I really don't know about IDEs in 
> general, and I suspect I would be out of my depth with one of those.

The property of basic to have explicit linenumbering is the reason 
you've been able to work in that style of programming, as you could 
simply overwrite parts of the  program. But that's close to undoable in 
all other languages.

   Python has the interactive REPL that you can use to toy around 
interactively and is very helpful to me - especially when enriched with 
rlcompleter2. - You can even replace functions or classes while working 
and toying around. But the amount of reasonable editing work that can be 
done in the interpreter is pretty limited. You _need_ a decent editor 
for that.

So what I usually do is to create a test.py that contains the code I 
want to tinker with, and simply run that in a shell - cygwin on windows, 
but usually I work in *NIX-style environments, so it's even easier. As 
there is no compilation or whatsoever required, that works pretty well 
for me.

Diez



More information about the Python-list mailing list