"shell-commands" and python!

Donn Cave donn at drizzle.com
Sat Sep 22 01:01:21 EDT 2001


Quoth Erik Max Francis <max at alcyone.com>:
[... re making Python do the shell's work ...]

| Because Python is not a shell script, and should not strive to be like
| them.  It's a different language.

That's absolutely right, the Bourne shell is a true application
scripting language, where the application is UNIX, and its nature
is all about providing a convenient interface to UNIX.  Python on
the other hand is a general purpose programming language, and you
can't roll up all the advantages of these two in one language.
However,

| Furthermore, many of the cases you talk about don't make sense.  Shell
| script redirections, pipes, etc. all assume there are sensible streams
| of data moving around.  That makes perfect for a shell, where they
| organize programs being run and their input and output, but what does it
| mean for Python code in general where no such streams exist?
|
| I think you're getting One Hammer Syndrome.  Why not use both, each for
| the purposes at which they're best suited?

It really is not a trivial matter to get a comprehensive grasp of
the Bourne shell, or worse the more bloated Korn shell or Bash.
And the shell isn't exactly the perfect programming environment.
When you start pushing data around, Python is far better.  So
there are valid reasons to think about using Python in place of
the shell, a way to deploy UNIX programs.

But for practical purposes, it really is always going to be easier
in most cases to use the shell, when in need of a shell.

	Donn Cave, donn at drizzle.com



More information about the Python-list mailing list