Newbie edit/compile/run cycle question
Diez B. Roggisch
deets at nospam.web.de
Sun Dec 9 09:35:05 EST 2007
MartinRinehart at gmail.com schrieb:
> Thanks for all the help. Thought I'd spend my newbie days right in the
> Python shell (there's lots to test when you're just starting) but I
> guess that's not going to happen.
>
> Everyone told me to get out of the Python shell, one way or another.
> OK. But this means that every execution must first load Python, then
> import my stuff. Import becoming a NOP after first use in the shell is
> a six-legged feature, at best.
Being a Java-guy you might thing that starting a runtime environment is
a costly operation. Trust me - with python it isn't. Starting the python
runtime usually takes fractions of a second.
If you want to work with the REPL (read/evaluate/print-loop), make sure
you install rlcompleter2. Google for it - it makes working with the
interpreter much easier.
However, I also recommend you to use small scriptlets to test out things
- I always have a shell open, and with
alt-tab
switch to it. Arrow-Up gives me the last commandline (e.g. python
/tmp/test.py) - and then hitting return will execute it.
This costs about 2-3 seconds, and spares me the troubles of misspellings
in larger statements and the like. And some of the nastier aspects of
reload (google for reload and my name to see a recent thread why I don't
recommend it)
Diez
More information about the Python-list
mailing list