Pipes

E.D.G. edgrsprj at ix.netcom.com
Mon Aug 10 16:43:26 EDT 2015


<rogerh906 at gmail.com> wrote in message 
news:d6a3dfe4-8389-463b-ac66-a93f14a91a5e at googlegroups.com...
> Just learning Python and have a question.

Posted by E.D.G. on August 10, 2015

       Roger's original post is largely a continuation of my July 25, 2015 
posting regarding "Python Questions."  His post does not actually explain 
what the general goal is here.  So I will explain it once again.

       It has been my experience that researchers, particularly scientists, 
need to have some versatile and powerful programming language available that 
is compatible with the Windows operating system.  The language needs to make 
certain resources available to the researchers.  And in some form it should 
ultimately be compatible with other operating systems.

       Among the needed resources would be the ability to open and close 
files, read from and write to files, open "pipes" to other Windows programs, 
execute system or shell commands, read and respond to keyboard key presses, 
send text etc. to a running Windows program such as Notepad.exe and have it 
printed on the screen, and read and write to the Windows clipboard.

       Other important resources would be the ability to perform rapid 
calculations and the ability to generate plots that could display on the 
screen and also be saved as .png files etc.

       The language also has to have the ability to be "cloned."  That means 
that it could be stored in some directory that could be copied from one 
computer to another.  And programs written with that language would then run 
on the new computer.  One person responding to my own earlier post stated 
that this is possible with Python.

       There are not too many programming languages that can do all of those 
things.  Perl and probably Fortran will.  But we could not get simple 
questions answered regarding how to do specific things such as open a "pipe" 
to a running Windows program.  And there are two versions of Fortran, 
gfortran and F95 that we looked at.  And we could not decided which one 
would work better.

       Python apparently also provides all of the necessary resources.  And 
as all of these posts demonstrate, it has the major advantage in that when a 
question gets asked in the Python newsgroup, there is usually an answer.

       It will likely be up to Roger to decide if we will go with gfortran 
or Python since he does most of the actual computer program code 
development.  Even though he prefers True Basic, I explained that we can't 
continue to use it.  For example, with the versions we have been using, when 
it is waiting for a key to be pressed it is using 100% of the processor 
time.  Perl and Fortran and probably Python just "go to sleep" while they 
are waiting for the Enter key to be pressed.  They largely stop using the 
processor.

       The following is an example of how it can be important for 
researchers to have a powerful and versatile programming language available:

       I needed a program that could generate data regarding the locations 
of the sun and the moon in the sky in response to specific times entered. 
Roger developed the basic equations with some help from another researcher. 
And that took a while.  But it probably took a full six months for us to 
compare notes by E-mail and get the program into a final form that people 
could download for free use.

       That is just too much time.  Researchers need to be able to do things 
such as create simple charts etc. without spending months or years learning 
some programming language or comparing notes with one another.  So, an 
entire Python directory that made that possible and that had clear 
instructions for how to open and close files and create "pipes" etc. would 
get the job done.

       If Roger wants to use Python then we might use the ActiveState 
version and then build those various resources into it.  It reportedly 
installs in a Windows environment without problems.  And I myself have used 
the ActiveState versions of Perl for quite a few years with a considerable 
amount of success.

       This assumes that the ActiveState version of Python can be taught to 
do fast calculations and to generate charts.  If that does not look possible 
or easy then we will probably try one of the available scientific versions 
of Python.

       Would researchers then put professional Python programmers "out of 
business?"

       The answer is probably just the opposite.  Researchers want to do 
research and not write computer programs.  And if they can do at least some 
programming themselves then it makes it easier for them to work with 
professional programmers and explain what needs to be done.  They are then 
more inclined to work with the programmers.  And they won't have to compare 
notes with them for six months just to get a relatively simple task 
completed.

Regards to all,

E.D.G.





More information about the Python-list mailing list