[Tutor] IDEs

Marc Tompkins marc.tompkins at gmail.com
Mon Nov 22 11:12:04 CET 2010

On Mon, Nov 22, 2010 at 1:13 AM, Josep M. Fontana <josep.m.fontana at gmail.com
> wrote:

> Alan gave me this piece of advice in his response to another message I
> sent to the list. Since the topic is a bit different from the one in
> the original message, I think it is better to start a different
> thread.
> > 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.
The issue is that phrase "production code".  If you're just noodling around,
"production" can mean printing "Hello World."  If, on the other hand, you're
writing Python code to solve real-world problems and the end goal is for
users to install and run your applications on their own machines... then
testing/running inside the IDE is an issue, because the environment is so
different from anything you'll find "in the wild."
The most egregious case is trying to run GUI code from inside of IDLE (the
basic IDE that ships with Python.)  Nothing works properly, and IDLE
introduces all sorts of weirdness, but people keep doing it.

Testing outside the IDE doesn't have to be a big deal.  You don't have to
type "$python filename.py" every time; you could keep a terminal window open
so you can just up-arrow through the command history, or (what I usually do)
create a shortcut to my file on the desktop.  Just make sure you've saved
your changes - you generally don't have to close the IDE.

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

The IDE spawns an instance of Python as a child process; it inherits the
IDE's environment.  That can lead to surprising behavior if you don't know
what's been set in the IDE'S environment.

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

Nobody is saying that you shouldn't debug in the IDE!  Just that the IDE is
not the best place to run finished code, nor is IDE-based debugging the last
step in testing code that's intended to run on other people's machines.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/tutor/attachments/20101122/e5e4ec74/attachment.html>

More information about the Tutor mailing list