[Tutor] creating interactive program with python

Andre Walker-Loud walksloud at gmail.com
Fri May 29 02:43:13 CEST 2009

Hi All,

I am thinking of creating a data analysis suite with python, and I  
want it to be interactive - ie the program asks the user (me) for  
input, like which data file to use, how many parameters to minimize,  
etc.  There are a few features I want it to have, like graphing, both  
the initial data as well as results of my analysis, etc.  If you are  
familiar with it, Matlab is close to what I would like, a sort of all  
in one tool - but that is expensive commercial software.

So I have a few questions.  And I should also say I would classify  
myself as a medium level python scripter, but I have not used the more  
advanced programming features, and I am a beginning programmer.  That  
being said, I am interested in expanding my python knowledge,  
especially getting into the more advanced features.  Even though this  
is ultimately just a tool to do my job (limiting my time to play  
around and learn new things) I generally find python so easy to use  
(and fun) that I am interested in this little project of mine (and  
also it will help me sever my dependency on Mathematica, if you are  
familiar with that program).



1) I am trying to trying to figure out how I would set up an  
interactive python script, however, I am having trouble googling this,  
since a search for "interactive python" just returns instructions on  
how to type "python" in a terminal to get an "interactive" session....

I have in mind a while loop that asks the user for arguments, and then  
some switch making sure I have passed enough sys.args to proceed, but  
I am not sure how to prompt the user for arguments and count them  
locally (not a global number of sys.argv which is what I am used to  
now).  So any advice on where to look at an example of this would be  

2) I have come across the "Scipy Superpack"


which contains Scipy, Numpy, Matplotlib, iPython and PyMC.  So it  
seems the installation would be convenient since it is all bundled  
together.  Anyone have experience with this package?

3) I see iPython (which I have never used) is an enhanced interactive  
python shell.  Perhaps this could do what I want - does anyone have  
experience with iPython?  Even if iPython can do everything I want  
(and more I am sure) I would still like to write my own basic little  
interactive script to expand my python knowledge.

4) does anyone have strong recommendations for or against using  
matplotlib?  Is it low maintenance for producing graphs, or does it  
take lots of user interaction?  All the example pictures I see are  
very pretty, but it is not clear how much effort is needed to generate  
them - or is it just a "well know to those who know it well" thing?

More information about the Tutor mailing list