how do "real" python programmers work?

Stormcoder stormtoad at gmail.com
Wed Jan 18 15:45:47 EST 2006


I might be a little late to the party but my comments may still be
valuable.

I write Python code in emacs. Emacs has an great python-mode. The code
I write can range from a GUI apps to server side code and emacs works
just as well in all cases. Some of the features that make emacs a good
Python editor is a built in code browser, embedded interactive shell,
evaluation of python code in either a region, class, function or the
whole buffer. I can force a reimport of the code in a buffer to the
interactive interpreter. Add onto those features all the nifty emacs
text editing features plus the ability to build tools on top of emacs
and you have a really good development system. I've used a number of
commercial and open source tools including Slickedit, and pretty much
all the Python specific tools out there and have come back to emacs
because it does what I need without getting in my way.

The way I work in this environment is that I will open my project files
then start an interpreter within emacs. So the way it looks when I
start is that I have a split window with my Python buffers on top with
a tab for each one. In emacs you can enable grouping for the tabs so
that when I am editing a certain kind of file only those tabs are
immediately visible. The bottom window has my interpreter. When I think
I am finished with a block of code (function, class etc) I will
evaluate it and make sure that it doesn't have any syntax errors. I can
then go down to the interactive interpreter that is in the bottom
window and test the function or class etc. I then go back up to the
editor and write more code, rinse repeat. This works extremely well for
me. I've written some large Python apps this way.

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).
>
> In Python, there seems to be a couple ways of doing things.   I could
> write it in one window, and from a Unix shell call
>                            python myscript.py
> and be like C++, but then I lose the interactiveness which makes
> prototyping easier.  If I use the python shell, I can use import (and
> reload), or execfile perhaps.
>
> How do experienced python programmers usually do it?  Is there a
> "usually" about it, or is it up to personal taste?  Are there any
> convenient ways of doing these things?
>
> I realize this is a pretty newbie question, but it could possibly save
> me hours of time if there is a better way to work.
> 
> 
>           thanks,
> 
>             Brian Blais




More information about the Python-list mailing list