Looking for a scripting language

Peter Hansen peter at engcorp.com
Sat May 4 23:35:15 EDT 2002


deckerben wrote:
> 
> I have decided that the black-and-white approach of 'just know C and Java'
> may not be sufficient. 

I believe in months to come, you'll look back on this decision of yours
as one of the smartest things you've done.  I certainly feel that way
two years after discovering Python.

> I ahve several windows scripts (batch files) that I
> would like to re-write in the language of a single interpreter.
[...]
> But the interpreter needs to be as flexible as a shell prompt in its ability
> to handle command-line arguments, file I/O, and extern-executable calls.
> 
> BTW: Can Python temporarily 'shell' to an external executable?

Try this:

Python 2.2.1 (#34, Apr  9 2002, 19:34:33) [MSC 32 bit (Intel)] on win32
>>> import os
>>> os.system('dir *.bat')

 Volume in drive C is DRIVE1-1
 Volume Serial Number is 2E17-18E1
 Directory of C:\

AUTOEXEC BAT           577  01-23-02  9:12p AUTOEXEC.BAT
TEST     BAT           146  03-13-02  9:02p test.bat
         2 file(s)            723 bytes
         0 dir(s)          285.65 MB free

Note that you can use the interactive prompt like this to 
experiment with the language and learn it very quickly.  
Do the tutorial!  http://www.python.org/doc/current/tut/tut.html

> I am currently considering: PERL, JAVASCRIPT, PYTHON and LISP.

Stop considering Javascript immediately.  It is a dog's breakfast
and not really intended for the sort of thing you need.  I believe
Lisp was not intended for such tasks either, though there may be
implementations that are capable.

Perl and Python are your only serious alternatives (from that list).
Those in this newsgroup would widely consider Python to be a
big improvement over Perl in the area of readability and maintainability.
Perl programs tend to be very difficult to read for others, or even the
original programmer, weeks or months after they are written.  It's
also fairly widely considered to be inadequate for large programs,
whereas Python is highly capable in this regard.

I have no qualms in recommending strongly that you adopt Python
for this and other tasks.  In fact, at my company we've basically
adopted Python exclusively except where it is simply incapable of
running (e.g. 16-bit embedded micros, or for client-side web
browser programming where really only Javascript is suitable).
All utilities, and now effectively all PC software of any kind,
plus some embedded stuff running on PC104 hardware, is written
in Python and the odd bit of C code for custom extensions.

> Which would work the best?

Definitely Python.

> Which one of these languages has the greatest demand for programmers at the
> moment?

Different target areas, so it depends on what you are trying to do.
I thought you wanted to rewrite some batch files, but now you are
more concerned about future employment potential?  In any case, it's
probably the case that those with knowledge of Perl more widely
employable by companies who are strongly interested in those with
specific language knowledge.  Perhaps those with knowledge of Python
would be more widely employable by those (in my opinion much more
interesting) companies which are less interested in the specific
languages you know than in your ability to communicate and learn
new things.

> Is there another language I should consider?

Not in my opinion.  Python is extremely capable.

-Peter



More information about the Python-list mailing list