Shell chauvinism ;-D, was Re: popen4 doesn't block?
hancock at anansispaceworks.com
Wed Jan 29 15:35:47 CET 2003
Jp Calderone wrote:
> Multi-thousand line programs should probably be written in actual
> programming languages, such as Python. There's a reason for this,
> discussed below.
There's a lot of reasons. :-D For one thing, tcsh doesn't even seem to
have functions -- the best you can do is make each "function" a separate
file. Nasty. I think this is what the bash folks are on about, since bash
evidently does have functions.
But shell scripts are very concise and clear for simple operations, and it
is nicer to be able to embed a few commands to do a particular job.
(Unpack tar file, cd into it, run ./configure, make, make install, and
sometimes a few other things).
I wound up wrapping the shell execution code into a factory object, so it
works pretty much like DTMLMethod() or SQL() in Zope now. A mid-size
directory holds a group of shell-scripts for installing each package, which
serves both as program and documentation, since the user can always just
type the scripts from the shell if they want to do it manually. I
abandoned this for the fancy stuff -- instead of using "patch" to fix
inappropriate upstream makefiles, I just used Python's re module to filter
them into place. Works pretty well.
> Python, on the other hand, was designed, in part, to be
> easy to _read_. This hasn't led to a language that is as easy to type as
> it could be.
In the very simple extreme of scripting a few commands, however, the Python
is also harder to read, IMHO. Don't get me wrong, I'm using Python for a
reason, but I have not found it to be such a strong *scripting* language,
which I find ironic, since some people seem to think that's what it's for.
It's like calling the Space Shuttle an airplane, it may be able to glide
through the air, but that's not what it was made for.
More information about the Python-list