[Tutor] IDEs

Alan Gauld alan.gauld at btinternet.com
Mon Nov 22 20:39:17 CET 2010


"Josep M. Fontana" <josep.m.fontana at gmail.com> wrote

>> Don;t run your code inside the IDE except for testing. IDEs are
>> Development Environments, they are not ideal for executing 
>> production
>> code. Run your file from the Terminal command prompt directly.
>
> I thought the code was not run inside the IDE but it was run by 
> Python
> independently, that is, the IDE just provides an interface.

Only partly true, the IDE wraps the interpreter so that it can catch
errors and warnings and in some cases treat them differently to the
way the ternminal would do it. Plus the IDE introduces a (small)
overhead so you may not get accurate timings.

But the biggest issues I find are that a lot of IDEs catch things
like Ctrl-C interrupts and either ignore them or don;t report them
accurately. Also some try to turn Pythons stack trace error reports
into dialog boxes or worse, highlighted bars in the editor - losing
a lot of detailed info about the bug in the process.

Finally some IDEs intersperse their printed output with the 
interactive
prompt window which makes it harder toi go bacvk and figure out
what came from the program and what was test input by you!

Also IDEs sometimes inherit spurious variable settings and imports
that you have set during an interactive sssion. Then you get bizarre
results which don't reflect the real behaviour of your code when run
from a command prompt or fuile explorer (Finder in your case).

> a) it is slower since I have to type $python filename.py (ok, this
> takes very little time but clicking a button or typing a key 
> shortcut
> to execute the code takes less time)

You can use command history to recall the last command.
Its very quick.

> b) with the terminal I don't get the debugging benefits that an IDE
> provides (I must say though that I still haven't really taken
> advantage of the benefits that Eclipse provides since the code I'm
> writing so far is pretty simple).

Debug your code in the IDE to the point that it looks right. Then
run it outside the IDE to make sure that it really is right! And
don't try to do timing or volume load testing in the IDE - it will
alter the results by a greater or lesser degree depending on
how the IDE is written. And unless you know how the IDE is
coded how do you know how much is the IDE and how much
your code?

IDEs are useful tools but thats all, development tools.
After all you wouldn't really test your car's acceleration in a
workshop test roller would you? You'd take it out on the road...

HTH,

-- 
Alan Gauld
Author of the Learn to Program web site
http://www.alan-g.me.uk/




More information about the Tutor mailing list