how do "real" python programmers work?
Barbier de Reuille Pierre
p.barbierdereuille at free.fr
Thu Jan 12 22:56:56 CET 2006
On 12 Jan 2006 12:20:50 -0800
"bblais" <bblais at gmail.com> wrote:
> 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.
> Brian Blais
Well, I think it will depend on your project ...
If you're developing GUI application, you will have trouble using the
python shell. At least you will need a special, customized shell that
will take care of launching the main loop of your GUI and let you enter
commands. But I don't think this is a big help to build GUI ...
Now, what I do for other stuffs (or when I have access to such a
modified shell). First, when I develop an object, I quit and
reload my script after each modification, mainly because problems
arises quickly with different variables with difference version of the
same class and you have no way to exactly know what variable hold what
version of the class. However, when I'm developing algorithms I reload
the modules while keeping the shell launched. Only at the very end do I
quit and relaunch to be 100% sure my algorithm is working with the
new versions of the modules ...
You will overcome the attacks of jealous associates.
More information about the Python-list