how do "real" python programmers work?

Fernando Perez fperez.net at gmail.com
Thu Jan 19 06:42:31 CET 2006


bblais wrote:

> Hello,
> 
> Let me start by saying that I am coming from a background using Matlab
> (or Octave), and C++.  I am going to outline the basic nuts-and-bolts
> of how I work in these languages, and ask for some help to find out how
> the same thing is done in Python.  I am not sure what the standard is.
> 
> In C++, I open up an editor in one window, a Unix shell in another.  I
> write the code in the editor, then switch to the shell window for
> compile and run.  I then go back to the editor for modifications, and
> then compile and run in the shell window.
> 
> In Matlab, I do much the same thing, except there is no compile phase.
> I have the editor on one window, the Matlab interactive shell in the
> other.  I often make a bunch of small scripts for exploration of a
> problem, before writing any larger apps.  I go back and forth editing
> the current file, and then running it directly (Matlab looks at the
> time stamp, and automagically reloads the script when I modify it).

You may be interested in looking at the ipython+matplotlib combo:

http://ipython.scipy.org
http://matplotlib.sf.net

If you start

ipython -pylab

you'll get an interactive shell that allows you to run scripts via a 'run'
command (for quick reloading), while giving you direct plotting (thanks to
matplotlib) and shell-like features (!cmd goes directly to the shell, and
many useful things like cd and ls are builtin).

This environment was specifically modeled after things like the Mathematica
and IDL shells (I don't use matlab myself), to try to make this kind of
workflow (typical of everyday scientific computing) as efficient and
pleasant and possible.

My normal workflow is a split screen with Xemacs on the left (pick your
favorite good editor) and a terminal on the right running ipython, both in 
full-vertical-maximize mode.  I edit in Xemacs, save and alt-tab to the
terminal to run the code (type 'r' and up-arrow to retrieve the previous
command starting with 'r').  Play with the resulting data from the run,
test, plot, etc.  Edit, repeat.

You can also enable ipython to be the interactive shell inside emacs if you
want.

I hope this is useful,

f




More information about the Python-list mailing list